home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / General / GCC 1.37.1r15 / GCC.MPW / md < prev    next >
Text File  |  1993-03-06  |  105KB  |  3,719 lines

  1. ;;- Machine description for GNU compiler
  2. ;;- Motorola 68000/Macintosh Version, extensively modified from the
  3. ;;  generic 68000 description.
  4. ;;   Copyright (C) 1987 Free Software Foundation, Inc.
  5. ;;   Copyright (C) 1989, 1990 Apple Computer, Inc.
  6.  
  7. ;; This file is part of GNU CC.
  8.  
  9. ;; GNU CC is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 1, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; GNU CC is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;; GNU General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU CC; see the file COPYING.  If not, write to
  21. ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  22.  
  23. ;; The Macintosh-specific changes lie in several areas: removal of the FPA
  24. ;; support to save space, addition of SANE support, alterations to asm
  25. ;; syntax to be appropriate to the MPW assembler, and a number of small
  26. ;; mods.
  27.  
  28. ;;- instruction definitions
  29.  
  30. ;;- @@The original PO technology requires these to be ordered by speed,
  31. ;;- @@    so that assigner will pick the fastest.
  32.  
  33. ;;- See file "rtl.def" for documentation on define_insn, match_*, et. al.
  34.  
  35. ;;- When naming insn's (operand 0 of define_insn) be careful about using
  36. ;;- names from other targets machine descriptions.
  37.  
  38. ;;- cpp macro #define NOTICE_UPDATE_CC in file tm.h handles condition code
  39. ;;- updates for most instructions.
  40.  
  41. ;;- Operand classes for the register allocator:
  42. ;;- 'a' one of the address registers can be used.
  43. ;;- 'd' one of the data registers can be used.
  44. ;;- 'f' one of the m68881 registers can be used
  45. ;;- 'r' either a data or an address register can be used.
  46.  
  47. ;;- Immediate Floating point operator constraints
  48. ;;- 'G' a floating point constant that is *NOT* one of the standard
  49. ;;   68881 constant values (to force calling output_move_const_double
  50. ;;   to get it from rom if it is a 68881 constant).
  51. ;;
  52. ;;   See the functions standard_XXX_constant_p in output-m68k.c for more
  53. ;; info.
  54.  
  55. ;;- Immedidate integer operands Constrains:
  56. ;;- 'I'  1 .. 8
  57. ;;- 'J'  -32768 .. 32767
  58. ;;- 'K'  -128 .. 127
  59. ;;- 'L'  -8 .. -1
  60.  
  61. ;;- Some of these insn's are composites of several m68000 op codes.
  62. ;;- The assembler (or final @@??) insures that the appropriate one is
  63. ;;- selected.
  64.  
  65. ;; why are these here and what are they for?
  66. (define_insn ""
  67.   [(set (match_operand:DF 0 "push_operand" "=m")
  68.     (match_operand:DF 1 "general_operand" "ro<>fF"))]
  69.   ""
  70.   "*
  71. {
  72.   if (FP_REG_P (operands[1]))
  73.     return \"fmove.d %1,%0\";
  74.   return output_move_double (operands);
  75. }")
  76.  
  77. (define_insn ""
  78.   [(set (match_operand:DI 0 "push_operand" "=m")
  79.     (match_operand:DI 1 "general_operand" "ro<>F"))]
  80.   ""
  81.   "*
  82. {
  83.   return output_move_double (operands);
  84. }")
  85.  
  86. (define_insn "tstsi"
  87.   [(set (cc0)
  88.     (match_operand:SI 0 "general_operand" "rm"))]
  89.   ""
  90.   "*
  91. {
  92.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  93.     return \"tst.l %0\";
  94.   /* If you think that the 68020 does not support tstl a0,
  95.      reread page B-167 of the 68020 manual more carefully.  */
  96.   /* On an address reg, cmpw may replace cmpl.  */
  97.   return \"cmp.w #0,%0\";
  98. }")
  99.  
  100. (define_insn "tsthi"
  101.   [(set (cc0)
  102.     (match_operand:HI 0 "general_operand" "rm"))]
  103.   ""
  104.   "*
  105. {
  106.   if (TARGET_68020 || ! ADDRESS_REG_P (operands[0]))
  107.     return \"tst.w %0\";
  108.   return \"cmp.w #0,%0\";
  109. }")
  110.  
  111. (define_insn "tstqi"
  112.   [(set (cc0)
  113.     (match_operand:QI 0 "general_operand" "dm"))]
  114.   ""
  115.   "tst.b %0")
  116.   
  117. (define_expand "tstsf"
  118.   [(set (cc0)
  119.     (match_operand:SF 0 "general_operand" ""))]
  120.   "TARGET_SANE || TARGET_68881"
  121.   "")
  122.  
  123. (define_insn ""
  124.   [(set (cc0)
  125.     (match_operand:SF 0 "general_operand" "fdm"))]
  126.   "TARGET_68881"
  127.   "*
  128. {
  129.   cc_status.flags = CC_IN_68881;
  130.   if (FP_REG_P (operands[0]))
  131.     return \"ftest.x %0\";
  132.   return \"ftest.s %0\";
  133. }")
  134.  
  135. (define_insn ""
  136.   [(set (cc0)
  137.     (match_operand:SF 0 "general_operand" "ro"))]
  138.   "TARGET_SANE"
  139.   "* return output_sane_tst (operands, 0x1008, \"FCMPS\");")
  140.  
  141. (define_expand "tstdf"
  142.   [(set (cc0)
  143.     (match_operand:DF 0 "general_operand" ""))]
  144.   "TARGET_SANE || TARGET_68881"
  145.   "")
  146.  
  147. (define_insn ""
  148.   [(set (cc0)
  149.     (match_operand:DF 0 "general_operand" "fm"))]
  150.   "TARGET_68881"
  151.   "*
  152. {
  153.   cc_status.flags = CC_IN_68881;
  154.   if (FP_REG_P (operands[0]))
  155.     return \"ftest.x %0\";
  156.   return \"ftest.d %0\";
  157. }")
  158.  
  159. (define_insn ""
  160.   [(set (cc0)
  161.     (match_operand:DF 0 "general_operand" "ro"))]
  162.   "TARGET_SANE"
  163.   "* return output_sane_tst (operands, 0x0808, \"FCMPD\");")
  164.  
  165. (define_expand "tstxf"
  166.   [(set (cc0)
  167.     (match_operand:XF 0 "general_operand" ""))]
  168.   "TARGET_SANE || TARGET_68881"
  169.   "")
  170.  
  171. (define_insn ""
  172.   [(set (cc0)
  173.     (match_operand:XF 0 "general_operand" "f"))]
  174.   "TARGET_68881"
  175.   "*
  176. {
  177.   cc_status.flags = CC_IN_68881;
  178.   return \"ftest.x %0\";
  179. }")
  180.  
  181. (define_insn ""
  182.   [(set (cc0)
  183.     (match_operand:XF 0 "general_operand" "ro"))]
  184.   "TARGET_SANE"
  185.   "* return output_sane_tst (operands, 0x0008, \"FCMPX\");")
  186.  
  187. ;; compare instructions.
  188.  
  189. ;; A composite of the cmp, cmpa, & cmpi m68000 op codes.
  190. ;; We use d*a in the constraints because compares with data regs are faster.
  191. (define_insn "cmpsi"
  192.   [(set (cc0)
  193.     (compare (match_operand:SI 0 "general_operand" "rM,mr,>")
  194.          (match_operand:SI 1 "general_operand" "mr,Mr,>")))]
  195.   ""
  196.   "*
  197. {
  198.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  199.     return \"cmpm.l %1,%0\";
  200.   if (REG_P (operands[1])
  201.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  202.     { cc_status.flags |= CC_REVERSED;
  203.       return \"cmp.l %d0,%d1\"; 
  204.     }
  205.   return \"cmp.l %d1,%d0\";
  206. }")
  207.  
  208. (define_insn "cmphi"
  209.   [(set (cc0)
  210.     (compare (match_operand:HI 0 "general_operand" "rnm,d,n,m")
  211.          (match_operand:HI 1 "general_operand" "d,rnm,m,n")))]
  212.   ""
  213.   "*
  214. {
  215.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  216.     return \"cmpm.w %1,%0\";
  217.   if ((REG_P (operands[1]) && !ADDRESS_REG_P (operands[1]))
  218.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  219.     { cc_status.flags |= CC_REVERSED;
  220.       return \"cmp.w %d0,%d1\"; 
  221.     }
  222.   return \"cmp.w %d1,%d0\";
  223. }")
  224.  
  225. (define_insn "cmpqi"
  226.   [(set (cc0)
  227.     (compare (match_operand:QI 0 "general_operand" "dn,d,m,>")
  228.          (match_operand:QI 1 "general_operand" "dm,nd,d,>")))]
  229.   ""
  230.   "*
  231. {
  232.   if (GET_CODE (operands[0]) == MEM && GET_CODE (operands[1]) == MEM)
  233.     return \"cmpm.b %1,%0\";
  234.   if (REG_P (operands[1])
  235.       || (!REG_P (operands[0]) && GET_CODE (operands[0]) != MEM))
  236.     { cc_status.flags |= CC_REVERSED;
  237.       return \"cmp.b %d0,%d1\";
  238.     }
  239.   return \"cmp.b %d1,%d0\";
  240. }")
  241.  
  242. (define_expand "cmpsf"
  243.   [(set (cc0)
  244.     (compare (match_operand:SF 0 "general_operand" "")
  245.          (match_operand:SF 1 "general_operand" "")))]
  246.   "TARGET_SANE || TARGET_68881"
  247.   "")
  248.  
  249. (define_insn ""
  250.   [(set (cc0)
  251.     (compare (match_operand:SF 0 "general_operand" "f,mdG")
  252.          (match_operand:SF 1 "general_operand" "fmdG,f")))]
  253.   "TARGET_68881"
  254.   "*
  255. {
  256.   cc_status.flags = CC_IN_68881;
  257.   if (FP_REG_P (operands[0]))
  258.     {
  259.       if (FP_REG_P (operands[1]))
  260.     return \"fcmp.x %1,%0\";
  261.       else
  262.         return \"fcmp.s %1,%0\";
  263.     }
  264.   cc_status.flags |= CC_REVERSED;
  265.   return \"fcmp.s %0,%1\";
  266. }")
  267.  
  268. (define_insn ""
  269.   [(set (cc0)
  270.     (compare (match_operand:SF 0 "general_operand" "ro")
  271.          (match_operand:SF 1 "general_operand" "ro")))]
  272.   "TARGET_SANE"
  273.   "* return output_sane_cmp (operands, 0x1008, \"FCMPS\");")
  274.  
  275. (define_expand "cmpdf"
  276.   [(set (cc0)
  277.     (compare (match_operand:DF 0 "general_operand" "")
  278.          (match_operand:DF 1 "general_operand" "")))]
  279.   "TARGET_SANE || TARGET_68881"
  280.   "")
  281.  
  282. (define_insn ""
  283.   [(set (cc0)
  284.     (compare (match_operand:DF 0 "general_operand" "f,mG")
  285.          (match_operand:DF 1 "general_operand" "fmG,f")))]
  286.   "TARGET_68881"
  287.   "*
  288. {
  289.   cc_status.flags = CC_IN_68881;
  290.   if (FP_REG_P (operands[0]))
  291.     {
  292.       if (FP_REG_P (operands[1]))
  293.     return \"fcmp.x %1,%0\";
  294.       else
  295.         return \"fcmp.d %1,%0\";
  296.     }
  297.   cc_status.flags |= CC_REVERSED;
  298.   return \"fcmp.d %0,%1\";
  299. }")
  300.  
  301. (define_insn ""
  302.   [(set (cc0)
  303.     (compare (match_operand:DF 0 "general_operand" "ro")
  304.          (match_operand:DF 1 "general_operand" "ro")))]
  305.   "TARGET_SANE"
  306.   "* return output_sane_cmp (operands, 0x0808, \"FCMPD\");")
  307.  
  308. (define_expand "cmpxf"
  309.   [(set (cc0)
  310.     (compare (match_operand:XF 0 "general_operand" "")
  311.          (match_operand:XF 1 "general_operand" "")))]
  312.   "TARGET_SANE || TARGET_68881"
  313.   "")
  314.  
  315. (define_insn ""
  316.   [(set (cc0)
  317.     (compare (match_operand:XF 0 "general_operand" "f,mG")
  318.          (match_operand:XF 1 "general_operand" "fmG,f")))]
  319.   "TARGET_68881"
  320.   "*
  321. {
  322.   cc_status.flags = CC_IN_68881; 
  323.   if (REG_P (operands[0]))
  324.     return \"fcmp.x %1,%0\";
  325.   cc_status.flags |= CC_REVERSED;
  326.   return \"fcmp.x %0,%1\";
  327. }")
  328.  
  329. (define_insn ""
  330.   [(set (cc0)
  331.     (compare (match_operand:XF 0 "general_operand" "ro")
  332.          (match_operand:XF 1 "general_operand" "ro")))]
  333.   "TARGET_SANE"
  334.   "* return output_sane_cmp(operands, 0x0008, \"FCMPX\");")
  335.  
  336. ;; Recognizers for btst instructions.
  337.  
  338. (define_insn ""
  339.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  340.                 (const_int 1)
  341.                 (minus:SI (const_int 7)
  342.                       (match_operand:SI 1 "general_operand" "di"))))]
  343.   ""
  344.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  345.  
  346. (define_insn ""
  347.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  348.                 (const_int 1)
  349.                 (minus:SI (const_int 31)
  350.                       (match_operand:SI 1 "general_operand" "di"))))]
  351.   ""
  352.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  353.  
  354. ;; The following two patterns are like the previous two
  355. ;; except that they use the fact that bit-number operands
  356. ;; are automatically masked to 3 or 5 bits.
  357.  
  358. (define_insn ""
  359.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "do")
  360.                 (const_int 1)
  361.                 (minus:SI (const_int 7)
  362.                       (and:SI
  363.                        (match_operand:SI 1 "general_operand" "d")
  364.                        (const_int 7)))))]
  365.   ""
  366.   "* { return output_btst (operands, operands[1], operands[0], insn, 7); }")
  367.  
  368. (define_insn ""
  369.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "d")
  370.                 (const_int 1)
  371.                 (minus:SI (const_int 31)
  372.                       (and:SI
  373.                        (match_operand:SI 1 "general_operand" "d")
  374.                        (const_int 31)))))]
  375.   ""
  376.   "* { return output_btst (operands, operands[1], operands[0], insn, 31); }")
  377.  
  378. ;; Nonoffsettable mem refs are ok in this one pattern
  379. ;; since we don't try to adjust them.
  380. (define_insn ""
  381.   [(set (cc0) (zero_extract (match_operand:QI 0 "nonimmediate_operand" "md")
  382.                 (const_int 1)
  383.                 (match_operand:SI 1 "general_operand" "i")))]
  384.   "GET_CODE (operands[1]) == CONST_INT"
  385.   "*
  386. {
  387.   operands[1] = gen_rtx (CONST_INT, VOIDmode, 7 - INTVAL (operands[1]));
  388.   return output_btst (operands, operands[1], operands[0], insn, 7);
  389. }")
  390.  
  391. (define_insn ""
  392.   ;; The constraint "o,d" here means that a nonoffsettable memref
  393.   ;; will match the first alternative, and its address will be reloaded.
  394.   ;; Copying the memory contents into a reg would be incorrect if the
  395.   ;; bit position is over 7.
  396.   [(set (cc0) (zero_extract (match_operand:HI 0 "nonimmediate_operand" "o,d")
  397.                 (const_int 1)
  398.                 (match_operand:SI 1 "general_operand" "i,i")))]
  399.   "GET_CODE (operands[1]) == CONST_INT"
  400.   "*
  401. {
  402.   if (GET_CODE (operands[0]) == MEM)
  403.     {
  404.       operands[0] = adj_offsettable_operand (operands[0],
  405.                         INTVAL (operands[1]) / 8);
  406.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  407.                  7 - INTVAL (operands[1]) % 8);
  408.       return output_btst (operands, operands[1], operands[0], insn, 7);
  409.     }
  410.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  411.              15 - INTVAL (operands[1]));
  412.   return output_btst (operands, operands[1], operands[0], insn, 15);
  413. }")
  414.  
  415. (define_insn ""
  416.   [(set (cc0) (zero_extract (match_operand:SI 0 "nonimmediate_operand" "do")
  417.                 (const_int 1)
  418.                 (match_operand:SI 1 "general_operand" "i")))]
  419.   "GET_CODE (operands[1]) == CONST_INT"
  420.   "*
  421. {
  422.   if (GET_CODE (operands[0]) == MEM)
  423.     {
  424.       operands[0] = adj_offsettable_operand (operands[0],
  425.                         INTVAL (operands[1]) / 8);
  426.       operands[1] = gen_rtx (CONST_INT, VOIDmode, 
  427.                  7 - INTVAL (operands[1]) % 8);
  428.       return output_btst (operands, operands[1], operands[0], insn, 7);
  429.     }
  430.   operands[1] = gen_rtx (CONST_INT, VOIDmode,
  431.              31 - INTVAL (operands[1]));
  432.   return output_btst (operands, operands[1], operands[0], insn, 31);
  433. }")
  434.  
  435. (define_insn ""
  436.   [(set (cc0)
  437.     (subreg:SI (lshiftrt:QI
  438.             (match_operand:QI 0 "nonimmediate_operand" "dm")
  439.             (const_int 7))
  440.            0))]
  441.   ""
  442.   "*
  443. {
  444.   cc_status.flags = CC_Z_IN_NOT_N | CC_NOT_NEGATIVE;
  445.   return \"tst.b %0\";
  446. }")
  447.  
  448. (define_insn ""
  449.   [(set (cc0)
  450.     (and:SI (sign_extend:SI
  451.          (sign_extend:HI
  452.           (match_operand:QI 0 "nonimmediate_operand" "dm")))
  453.         (match_operand:SI 1 "general_operand" "i")))]
  454.   "(GET_CODE (operands[1]) == CONST_INT
  455.     && (unsigned) INTVAL (operands[1]) < 0x100
  456.     && exact_log2 (INTVAL (operands[1])) >= 0)"
  457.   "*
  458. { register int log = exact_log2 (INTVAL (operands[1]));
  459.   operands[1] = gen_rtx (CONST_INT, VOIDmode, log);
  460.   return output_btst (operands, operands[1], operands[0], insn, 7);
  461. }")
  462.  
  463. ;; move instructions
  464.  
  465. ;; A special case in which it is not desirable
  466. ;; to reload the constant into a data register.
  467. (define_insn ""
  468.   [(set (match_operand:SI 0 "push_operand" "=m")
  469.     (match_operand:SI 1 "general_operand" "J"))]
  470.   "GET_CODE (operands[1]) == CONST_INT
  471.    && INTVAL (operands[1]) >= -0x8000
  472.    && INTVAL (operands[1]) < 0x8000"
  473.   "*
  474. {
  475.   if (operands[1] == const0_rtx)
  476.     return \"clr.l %0\";
  477.   return \"pea %a1\";
  478. }")
  479.  
  480. ;This is never used.
  481. ;(define_insn "swapsi"
  482. ;  [(set (match_operand:SI 0 "general_operand" "r")
  483. ;    (match_operand:SI 1 "general_operand" "r"))
  484. ;   (set (match_dup 1) (match_dup 0))]
  485. ;  ""
  486. ;  "exg %1,%0")
  487.  
  488. ;; Special case of fullword move when source is zero.
  489. ;; The reason this is special is to avoid loading a zero
  490. ;; into a data reg with moveq in order to store it elsewhere.
  491.    
  492. (define_insn ""
  493.   [(set (match_operand:SI 0 "general_operand" "=g")
  494.     (const_int 0))]
  495.   ""
  496.   "*
  497. {
  498.   if (ADDRESS_REG_P (operands[0]))
  499.     return \"sub.l %0,%0\";
  500.   return \"clr.l %0\";
  501. }")
  502.  
  503. ;; General case of fullword move.  The register constraints
  504. ;; force integer constants in range for a moveq to be reloaded
  505. ;; if they are headed for memory.
  506. (define_insn "movsi"
  507.   ;; Notes: make sure no alternative allows g vs g.
  508.   ;; We don't allow f-regs since fixed point cannot go in them.
  509.   [(set (match_operand:SI 0 "general_operand" "=dam")
  510.     (match_operand:SI 1 "general_operand" "dami"))]
  511.   ""
  512.   "*
  513. {
  514.   if (GET_CODE (operands[1]) == CONST_INT)
  515.     {
  516.       if (operands[1] == const0_rtx
  517.       && (DATA_REG_P (operands[0])
  518.           || GET_CODE (operands[0]) == MEM))
  519.     return \"clr.l %0\";
  520.       else if (DATA_REG_P (operands[0])
  521.            && INTVAL (operands[1]) < 128
  522.            && INTVAL (operands[1]) >= -128)
  523.         {
  524.           return \"moveq.l %1,%0\";
  525.     }
  526.       else if (ADDRESS_REG_P (operands[0])
  527.            && INTVAL (operands[1]) < 0x8000
  528.            && INTVAL (operands[1]) >= -0x8000)
  529.     return \"move.w %1,%0\";
  530.       else if (push_operand (operands[0], SImode)
  531.            && INTVAL (operands[1]) < 0x8000
  532.            && INTVAL (operands[1]) >= -0x8000)
  533.         return \"pea %a1\";
  534.     }
  535.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  536.         || GET_CODE (operands[1]) == CONST)
  537.        && push_operand (operands[0], SImode))
  538.     return \"pea %a1\";
  539.   else if ((GET_CODE (operands[1]) == SYMBOL_REF
  540.         || GET_CODE (operands[1]) == CONST)) {
  541.            if (ADDRESS_REG_P (operands[0])) {
  542.                return \"lea %a1,%0\";
  543.            } else {
  544.                return \"pea %a1\;move.l (sp)+,%0\";
  545.            }
  546.   }
  547.   return \"move.l %1,%0\";
  548. }")
  549.  
  550. (define_insn "movhi"
  551.   [(set (match_operand:HI 0 "general_operand" "=g")
  552.     (match_operand:HI 1 "general_operand" "g"))]
  553.   ""
  554.   "*
  555. {
  556.   if (GET_CODE (operands[1]) == CONST_INT)
  557.     {
  558.       if (operands[1] == const0_rtx
  559.       && (DATA_REG_P (operands[0])
  560.           || GET_CODE (operands[0]) == MEM))
  561.     return \"clr.w %0\";
  562.       else if (DATA_REG_P (operands[0])
  563.            && INTVAL (operands[1]) < 128
  564.            && INTVAL (operands[1]) >= -128)
  565.         {
  566.           return \"moveq.l %1,%0\";
  567.     }
  568.       else if (INTVAL (operands[1]) < 0x8000
  569.            && INTVAL (operands[1]) >= -0x8000)
  570.     return \"move.w %1,%0\";
  571.     }
  572.   else if (CONSTANT_P (operands[1]))
  573.     return \"move.l %1,%0\";
  574.   return \"move.w %1,%0\";
  575. }")
  576.  
  577. (define_insn "movstricthi"
  578.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+dm"))
  579.     (match_operand:HI 1 "general_operand" "rmn"))]
  580.   ""
  581.   "*
  582. {
  583.   if (GET_CODE (operands[1]) == CONST_INT)
  584.     {
  585.       if (operands[1] == const0_rtx
  586.       && (DATA_REG_P (operands[0])
  587.           || GET_CODE (operands[0]) == MEM))
  588.     return \"clr.w %0\";
  589.     }
  590.   return \"move.w %1,%0\";
  591. }")
  592.  
  593. (define_insn "movqi"
  594.   [(set (match_operand:QI 0 "general_operand" "=d,*a,m")
  595.     (match_operand:QI 1 "general_operand" "dmi*a,d*a,dmi"))]
  596.   ""
  597.   "*
  598. {
  599.   if (operands[1] == const0_rtx)
  600.     return \"clr.b %0\";
  601.   if (GET_CODE (operands[1]) == CONST_INT
  602.       && INTVAL (operands[1]) == -1)
  603.     return \"st %0\";
  604.   if (GET_CODE (operands[1]) != CONST_INT && CONSTANT_P (operands[1]))
  605.     return \"move.l %1,%0\";
  606.   if (ADDRESS_REG_P (operands[0]) || ADDRESS_REG_P (operands[1]))
  607.     return \"move.w %1,%0\";
  608.   return \"move.b %1,%0\";
  609. }")
  610.  
  611. (define_insn "movstrictqi"
  612.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+dm"))
  613.     (match_operand:QI 1 "general_operand" "dmn"))]
  614.   ""
  615.   "*
  616. {
  617.   if (operands[1] == const0_rtx)
  618.     return \"clr.b %0\";
  619.   return \"move.b %1,%0\";
  620. }")
  621.  
  622. (define_insn "movsf"
  623.   [(set (match_operand:SF 0 "general_operand" "=rmf")
  624.     (match_operand:SF 1 "general_operand" "rmfF"))]
  625.   ""
  626.   "*
  627. {
  628.   if (FP_REG_P (operands[0]))
  629.     {
  630.       if (FP_REG_P (operands[1]))
  631.     return \"fmove.x %1,%0\";
  632.       else if (ADDRESS_REG_P (operands[1]))
  633.     return \"move.l %1,-(sp)\;fmove.s (sp)+,%0\";
  634.       else if (GET_CODE (operands[1]) == CONST_DOUBLE)
  635.     return output_move_const_single (operands);
  636.       return \"fmove.s %1,%0\";
  637.     }
  638.   if (FP_REG_P (operands[1]))
  639.     {
  640.       if (ADDRESS_REG_P (operands[0]))
  641.     return \"fmove.s %1,-(sp)\;move.l (sp)+,%0\";
  642.       return \"fmove.s %1,%0\";
  643.     }
  644.   return \"move.l %f1,%0\";
  645. }")
  646.  
  647. (define_insn "movdf"
  648.   [(set (match_operand:DF 0 "general_operand" "=rm,&rf,&ro<>f")
  649.     (match_operand:DF 1 "general_operand" "rf,m,ro<>fF"))]
  650.   ""
  651.   "*
  652. {
  653.   if (FP_REG_P (operands[0]))
  654.     {
  655.       if (FP_REG_P (operands[1]))
  656.     return \"fmove.x %1,%0\";
  657.       if (REG_P (operands[1]))
  658.     {
  659.       rtx xoperands[2];
  660.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  661.       output_asm_insn (\"move.l %1,-(sp)\", xoperands);
  662.       output_asm_insn (\"move.l %1,-(sp)\", operands);
  663.       return \"fmove.d (sp)+,%0\";
  664.     }
  665.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  666.     return output_move_const_double (operands);
  667.       return \"fmove.d %1,%0\";
  668.     }
  669.   else if (FP_REG_P (operands[1]))
  670.     {
  671.       if (REG_P (operands[0]))
  672.     {
  673.       output_asm_insn (\"fmove.d %1,-(sp)\;move.l (sp)+,%0\", operands);
  674.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  675.       return \"move.l (sp)+,%0\";
  676.     }
  677.       else
  678.         return \"fmove.d %1,%0\";
  679.     }
  680.   return output_move_double (operands);
  681. }
  682. ")
  683.  
  684. ;; In the following defn, note that FP regs occur iff nums are 96 bits.
  685.  
  686. (define_insn "movxf"
  687.   [(set (match_operand:XF 0 "general_operand" "=&ro<>f")
  688.     (match_operand:XF 1 "general_operand" "ro<>fF"))]
  689.   ""
  690.   "*
  691. {
  692.   if (FP_REG_P (operands[0]))
  693.     {
  694.       if (FP_REG_P (operands[1]))
  695.     return \"fmove.x %1,%0\";
  696.       if (REG_P (operands[1]))
  697.     {
  698.       rtx xoperands[2], xxoperands[2];
  699.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  700.       xxoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 2);
  701.       output_asm_insn (\"move.l %1,-(sp)\", xxoperands);
  702.       output_asm_insn (\"move.l %1,-(sp)\", xoperands);
  703.       output_asm_insn (\"move.l %1,-(sp)\", operands);
  704.       return \"fmove.x (sp)+,%0\";
  705.     }
  706.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  707.     return output_move_const_long_double (operands);
  708.       return \"fmove.x %1,%0\";
  709.     }
  710.   else if (FP_REG_P (operands[1]))
  711.     {
  712.       if (REG_P (operands[0]))
  713.     {
  714.       output_asm_insn (\"fmove.x %1,-(sp)\;move.l (sp)+,%0\", operands);
  715.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  716.       output_asm_insn (\"move.l (sp)+,%0\", operands);
  717.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  718.       return \"move.l (sp)+,%0\";
  719.     }
  720.       else
  721.         return \"fmove.x %1,%0\";
  722.     }
  723.   return output_move_extended (operands);
  724. }
  725. ")
  726.  
  727. ;; movdi can apply to fp regs in some cases
  728. (define_insn "movdi"
  729.   ;; Let's see if it really still needs to handle fp regs, and, if so, why.
  730.   [(set (match_operand:DI 0 "general_operand" "=rm,&rf,&ro<>,!&rm,!&f")
  731.     (match_operand:DI 1 "general_operand" "r,m,roi<>,fF,rfF"))]
  732.   ""
  733.   "*
  734. {
  735.   if (FP_REG_P (operands[0]))
  736.     {
  737.       if (FP_REG_P (operands[1]))
  738.     return \"fmove.x %1,%0\";
  739.       if (REG_P (operands[1]))
  740.     {
  741.       rtx xoperands[2];
  742.       xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  743.       output_asm_insn (\"move.l %1,-(sp)\", xoperands);
  744.       output_asm_insn (\"move.l %1,-(sp)\", operands);
  745.       return \"fmove.d (sp)+,%0\";
  746.     }
  747.       if (GET_CODE (operands[1]) == CONST_DOUBLE)
  748.     return output_move_const_double (operands);
  749.       return \"fmove.d %1,%0\";
  750.     }
  751.   else if (FP_REG_P (operands[1]))
  752.     {
  753.       if (REG_P (operands[0]))
  754.     {
  755.       output_asm_insn (\"fmove.d %1,-(sp)\;move.l (sp)+,%0\", operands);
  756.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  757.       return \"move.l (sp)+,%0\";
  758.     }
  759.       else
  760.         return \"fmove.d %1,%0\";
  761.     }
  762.   return output_move_double (operands);
  763. }
  764. ")
  765.  
  766. ;; Thus goes after the move instructions
  767. ;; because the move instructions are better (require no spilling)
  768. ;; when they can apply.  It goes before the add/sub insns
  769. ;; so we will prefer it to them.
  770.  
  771. (define_insn "pushasi"
  772.   [(set (match_operand:SI 0 "push_operand" "=m")
  773.     (match_operand:SI 1 "address_operand" "p"))]
  774.   ""
  775.   "pea %a1")
  776.  
  777. ;; truncation instructions
  778. (define_insn "truncsiqi2"
  779.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  780.     (truncate:QI
  781.      (match_operand:SI 1 "general_operand" "doJ,i")))]
  782.   ""
  783.   "*
  784. {
  785.   if (GET_CODE (operands[0]) == REG)
  786.     return \"move.l %1,%0\";
  787.   if (GET_CODE (operands[1]) == MEM)
  788.     operands[1] = adj_offsettable_operand (operands[1], 3);
  789.   return \"move.b %1,%0\";
  790. }")
  791.  
  792. (define_insn "trunchiqi2"
  793.   [(set (match_operand:QI 0 "general_operand" "=dm,d")
  794.     (truncate:QI
  795.      (match_operand:HI 1 "general_operand" "doJ,i")))]
  796.   ""
  797.   "*
  798. {
  799.   if (GET_CODE (operands[0]) == REG)
  800.     return \"move.l %1,%0\";
  801.   if (GET_CODE (operands[1]) == MEM)
  802.     operands[1] = adj_offsettable_operand (operands[1], 1);
  803.   return \"move.b %1,%0\";
  804. }")
  805.  
  806. (define_insn "truncsihi2"
  807.   [(set (match_operand:HI 0 "general_operand" "=dm,d")
  808.     (truncate:HI
  809.      (match_operand:SI 1 "general_operand" "roJ,i")))]
  810.   ""
  811.   "*
  812. {
  813.   if (GET_CODE (operands[0]) == REG)
  814.     return \"move.l %1,%0\";
  815.   if (GET_CODE (operands[1]) == MEM)
  816.     operands[1] = adj_offsettable_operand (operands[1], 2);
  817.   return \"move.w %1,%0\";
  818. }")
  819.  
  820. ;; zero extension instructions
  821.  
  822. (define_expand "zero_extendhisi2"
  823.   [(set (match_operand:SI 0 "register_operand" "")
  824.     (const_int 0))
  825.    (set (strict_low_part (subreg:HI (match_dup 0) 0))
  826.     (match_operand:HI 1 "general_operand" ""))]
  827.   ""
  828.   "operands[1] = make_safe_from (operands[1], operands[0]);")
  829.  
  830. (define_expand "zero_extendqihi2"
  831.   [(set (match_operand:HI 0 "register_operand" "")
  832.     (const_int 0))
  833.    (set (strict_low_part (subreg:QI (match_dup 0) 0))
  834.     (match_operand:QI 1 "general_operand" ""))]
  835.   ""
  836.   "operands[1] = make_safe_from (operands[1], operands[0]);")
  837.  
  838. (define_expand "zero_extendqisi2"
  839.   [(set (match_operand:SI 0 "register_operand" "")
  840.     (const_int 0))
  841.    (set (strict_low_part (subreg:QI (match_dup 0) 0))
  842.     (match_operand:QI 1 "general_operand" ""))]
  843.   ""
  844.   " operands[1] = make_safe_from (operands[1], operands[0]); ")
  845.  
  846. ;; Patterns to recognize zero-extend insns produced by the combiner.
  847.  
  848. ;; Note that the one starting from HImode comes before those for QImode
  849. ;; so that a constant operand will match HImode, not QImode.
  850. (define_insn ""
  851.   [(set (match_operand:SI 0 "general_operand" "=do<>")
  852.     (zero_extend:SI
  853.      (match_operand:HI 1 "general_operand" "rmn")))]
  854.   ""
  855.   "*
  856. {
  857.   if (DATA_REG_P (operands[0]))
  858.     {
  859.       if (GET_CODE (operands[1]) == REG
  860.       && REGNO (operands[0]) == REGNO (operands[1]))
  861.     return \"and.l #$FFFF,%0\";
  862.       if (reg_mentioned_p (operands[0], operands[1]))
  863.         return \"move.w %1,%0\;and.l #$FFFF,%0\";
  864.       return \"clr.l %0\;move.w %1,%0\";
  865.     }
  866.   else if (GET_CODE (operands[0]) == MEM
  867.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  868.     return \"move.w %1,%0\;clr.w %0\";
  869.   else if (GET_CODE (operands[0]) == MEM
  870.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  871.     return \"clr.w %0\;move.w %1,%0\";
  872.   else
  873.     {
  874.       output_asm_insn (\"clr.w %0\", operands);
  875.       operands[0] = adj_offsettable_operand (operands[0], 2);
  876.       return \"move.w %1,%0\";
  877.     }
  878. }")
  879.  
  880. (define_insn ""
  881.   [(set (match_operand:HI 0 "general_operand" "=do<>")
  882.     (zero_extend:HI
  883.      (match_operand:QI 1 "general_operand" "dmn")))]
  884.   ""
  885.   "*
  886. {
  887.   if (DATA_REG_P (operands[0]))
  888.     {
  889.       if (GET_CODE (operands[1]) == REG
  890.       && REGNO (operands[0]) == REGNO (operands[1]))
  891.     return \"and.w #$FF,%0\";
  892.       if (reg_mentioned_p (operands[0], operands[1]))
  893.         return \"move.b %1,%0\;and.w #$FF,%0\";
  894.       return \"clr.w %0\;move.b %1,%0\";
  895.     }
  896.   else if (GET_CODE (operands[0]) == MEM
  897.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  898.     {
  899.       if (REGNO (XEXP (XEXP (operands[0], 0), 0))
  900.       == STACK_POINTER_REGNUM)
  901.     return \"clr.w -(sp)\;move.b %1,%0\";
  902.       else
  903.     return \"move.b %1,%0\;clr.b %0\";
  904.     }
  905.   else if (GET_CODE (operands[0]) == MEM
  906.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  907.     return \"clr.b %0\;move.b %1,%0\";
  908.   else
  909.     {
  910.       output_asm_insn (\"clr.b %0\", operands);
  911.       operands[0] = adj_offsettable_operand (operands[0], 1);
  912.       return \"move.b %1,%0\";
  913.     }
  914. }")
  915.  
  916. (define_insn ""
  917.   [(set (match_operand:SI 0 "general_operand" "=do<>")
  918.     (zero_extend:SI
  919.      (match_operand:QI 1 "general_operand" "dmn")))]
  920.   ""
  921.   "*
  922. {
  923.   if (DATA_REG_P (operands[0]))
  924.     {
  925.       if (GET_CODE (operands[1]) == REG
  926.       && REGNO (operands[0]) == REGNO (operands[1]))
  927.     return \"and.l #$FF,%0\";
  928.       if (reg_mentioned_p (operands[0], operands[1]))
  929.         return \"move.b %1,%0\;and.l #$FF,%0\";
  930.       return \"clr.l %0\;move.b %1,%0\";
  931.     }
  932.   else if (GET_CODE (operands[0]) == MEM
  933.        && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC)
  934.     {
  935.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  936.       return \"clr.l -(%0)\;move.b %1,(3,%0)\";
  937.     }
  938.   else if (GET_CODE (operands[0]) == MEM
  939.        && GET_CODE (XEXP (operands[0], 0)) == POST_INC)
  940.     {
  941.       operands[0] = XEXP (XEXP (operands[0], 0), 0);
  942.       return \"clr.l (%0)+\;move.b %1,(-1,%0)\";
  943.     }
  944.   else
  945.     {
  946.       output_asm_insn (\"clr.l %0\", operands);
  947.       operands[0] = adj_offsettable_operand (operands[0], 3);
  948.       return \"move.b %1,%0\";
  949.     }
  950. }")
  951.  
  952. ;; sign extension instructions
  953. ;; Note that the one starting from HImode comes before those for QImode
  954. ;; so that a constant operand will match HImode, not QImode.
  955.  
  956. (define_insn "extendhisi2"
  957.   [(set (match_operand:SI 0 "general_operand" "=*d,a")
  958.     (sign_extend:SI
  959.      (match_operand:HI 1 "general_operand" "0,rmn")))]
  960.   ""
  961.   "*
  962. {
  963.   if (ADDRESS_REG_P (operands[0]))
  964.     return \"move.w %1,%0\";
  965.   return \"ext.l %0\";
  966. }")
  967.  
  968. (define_insn "extendqihi2"
  969.   [(set (match_operand:HI 0 "general_operand" "=d")
  970.     (sign_extend:HI
  971.      (match_operand:QI 1 "general_operand" "0")))]
  972.   ""
  973.   "ext.w %0")
  974.  
  975. (define_insn "extendqisi2"
  976.   [(set (match_operand:SI 0 "general_operand" "=d")
  977.     (sign_extend:SI
  978.      (match_operand:QI 1 "general_operand" "0")))]
  979.   "TARGET_68020"
  980.   "extb.l %0")
  981.  
  982. ;; Conversions between float, double, and long double.
  983.  
  984. (define_expand "extendsfdf2"
  985.   [(set (match_operand:DF 0 "general_operand" "")
  986.     (float_extend:DF
  987.       (match_operand:SF 1 "general_operand" "")))]
  988.   "TARGET_SANE || TARGET_68881"
  989.   "")
  990.  
  991. (define_insn ""
  992.   [(set (match_operand:DF 0 "general_operand" "=*fdm,f")
  993.     (float_extend:DF
  994.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  995.   "TARGET_68881"
  996.   "*
  997. {
  998.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  999.     {
  1000.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1001.     {
  1002.       /* Extending float to double in an fp-reg is a no-op.
  1003.          NOTICE_UPDATE_CC has already assumed that the
  1004.          cc will be set.  So cancel what it did.  */
  1005.       cc_status = cc_prev_status;
  1006.       return \"\";
  1007.     }
  1008.       return \"fmove.x %1,%0\";
  1009.     }
  1010.   if (FP_REG_P (operands[0]))
  1011.     return \"fmove.s %1,%0\";
  1012.   if (DATA_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1013.     {
  1014.       output_asm_insn (\"fmove.d %1,-(sp)\;move.l (sp)+,%0\", operands);
  1015.       /* seems unreliable - what if opnd 0 was d7? */
  1016.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1017.       return \"move.l (sp)+,%0\";
  1018.     }
  1019.   if (FP_REG_P (operands[0]) || FP_REG_P (operands[1]))
  1020.     return \"fmove.d %1,%0\";
  1021. }")
  1022.  
  1023. (define_insn ""
  1024.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1025.     (float_extend:DF
  1026.       (match_operand:SF 1 "general_operand" "ro")))]
  1027.   "TARGET_SANE"
  1028.   "* return output_sane_convert(operands);")
  1029.  
  1030. (define_expand "extendsfxf2"
  1031.   [(set (match_operand:XF 0 "general_operand" "")
  1032.     (float_extend:XF
  1033.       (match_operand:SF 1 "general_operand" "")))]
  1034.   "TARGET_SANE || TARGET_68881"
  1035.   "")
  1036.  
  1037. (define_insn ""
  1038.   [(set (match_operand:XF 0 "general_operand" "=*fm,f")
  1039.     (float_extend:XF
  1040.       (match_operand:SF 1 "general_operand" "f,dmF")))]
  1041.   "TARGET_68881"
  1042.   "*
  1043. {
  1044.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1045.     {
  1046.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1047.     {
  1048.       /* Extending float to long double in an fp-reg is a no-op.
  1049.          NOTICE_UPDATE_CC has already assumed that the
  1050.          cc will be set.  So cancel what it did.  */
  1051.       cc_status = cc_prev_status;
  1052.       return \"\";
  1053.     }
  1054.       return \"fmove.x %1,%0\";
  1055.     }
  1056.   if (FP_REG_P (operands[0]))
  1057.     return \"fmove.s %1,%0\";
  1058.   return \"fmove.x %1,%0\";
  1059. }")
  1060.  
  1061. (define_insn ""
  1062.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1063.     (float_extend:XF
  1064.       (match_operand:SF 1 "general_operand" "ro")))]
  1065.   "TARGET_SANE"
  1066.   "* return output_sane_convert(operands);")
  1067.  
  1068. (define_expand "extenddfxf2"
  1069.   [(set (match_operand:XF 0 "general_operand" "")
  1070.     (float_extend:XF
  1071.       (match_operand:DF 1 "general_operand" "")))]
  1072.   "TARGET_SANE || TARGET_68881"
  1073.   "")
  1074.  
  1075. (define_insn ""
  1076.   [(set (match_operand:XF 0 "general_operand" "=*fm,f")
  1077.     (float_extend:XF
  1078.       (match_operand:DF 1 "general_operand" "f,mF")))]
  1079.   "TARGET_68881"
  1080.   "*
  1081. {
  1082.   if (FP_REG_P (operands[0]) && FP_REG_P (operands[1]))
  1083.     {
  1084.       if (REGNO (operands[0]) == REGNO (operands[1]))
  1085.     {
  1086.       /* Extending double to long double in an fp-reg is a no-op.
  1087.          NOTICE_UPDATE_CC has already assumed that the
  1088.          cc will be set.  So cancel what it did.  */
  1089.       cc_status = cc_prev_status;
  1090.       return \"\";
  1091.     }
  1092.       return \"fmove.x %1,%0\";
  1093.     }
  1094.   if (FP_REG_P (operands[0]))
  1095.     return \"fmove.d %1,%0\";
  1096.   return \"fmove.x %1,%0\";
  1097. }")
  1098.  
  1099. (define_insn ""
  1100.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1101.     (float_extend:XF
  1102.       (match_operand:DF 1 "general_operand" "ro")))]
  1103.   "TARGET_SANE"
  1104.   "* return output_sane_convert (operands);")
  1105.  
  1106. ;; Truncation of floats.
  1107.  
  1108. (define_expand "truncdfsf2"
  1109.   [(set (match_operand:SF 0 "general_operand" "")
  1110.     (float_truncate:SF
  1111.       (match_operand:DF 1 "general_operand" "")))]
  1112.   "TARGET_SANE || TARGET_68881"
  1113.   "")
  1114.  
  1115. ;; This cannot output into an f-reg because there is no way to be
  1116. ;; sure of truncating in that case.
  1117.  
  1118. (define_insn ""
  1119.   [(set (match_operand:SF 0 "general_operand" "=dm")
  1120.     (float_truncate:SF
  1121.       (match_operand:DF 1 "general_operand" "f")))]
  1122.   "TARGET_68881"
  1123.   "fmove.s %1,%0")
  1124.  
  1125. (define_insn ""
  1126.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1127.     (float_truncate:SF
  1128.       (match_operand:DF 1 "general_operand" "ro")))]
  1129.   "TARGET_SANE"
  1130.   "* return output_sane_convert (operands);")
  1131.  
  1132. (define_expand "truncxfsf2"
  1133.   [(set (match_operand:SF 0 "general_operand" "")
  1134.     (float_truncate:SF
  1135.       (match_operand:XF 1 "general_operand" "")))]
  1136.   "TARGET_SANE || TARGET_68881"
  1137.   "")
  1138.  
  1139. (define_insn ""
  1140.   [(set (match_operand:SF 0 "general_operand" "=dm")
  1141.     (float_truncate:SF
  1142.       (match_operand:XF 1 "general_operand" "f")))]
  1143.   "TARGET_68881"
  1144.   "fmove.s %1,%0")
  1145.  
  1146. (define_insn ""
  1147.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1148.     (float_truncate:SF
  1149.       (match_operand:XF 1 "general_operand" "ro")))]
  1150.   "TARGET_SANE"
  1151.   "* return output_sane_convert (operands);")
  1152.  
  1153. (define_expand "truncxfdf2"
  1154.   [(set (match_operand:DF 0 "general_operand" "")
  1155.     (float_truncate:DF
  1156.       (match_operand:XF 1 "general_operand" "")))]
  1157.   "TARGET_SANE || TARGET_68881"
  1158.   "")
  1159.  
  1160. ;; This cannot output into an f-reg because there is no way to be
  1161. ;; sure of truncating in that case.
  1162.  
  1163. (define_insn ""
  1164.   [(set (match_operand:DF 0 "general_operand" "=dm")
  1165.     (float_truncate:DF
  1166.       (match_operand:XF 1 "general_operand" "f")))]
  1167.   "TARGET_68881"
  1168.   "*
  1169. {
  1170.   if (DATA_REG_P (operands[0]))
  1171.     {
  1172.       output_asm_insn (\"fmove.d %1,-(sp)\;move.l (sp)+,%0\", operands);
  1173.       operands[0] = gen_rtx (REG, SImode, REGNO (operands[0]) + 1);
  1174.       return \"move.l (sp)+,%0\";
  1175.     }
  1176.   return \"fmove.d %1,%0\";
  1177. }")
  1178.  
  1179. (define_insn ""
  1180.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1181.     (float_truncate:DF
  1182.       (match_operand:XF 1 "general_operand" "ro")))]
  1183.   "TARGET_SANE"
  1184.   "* return output_sane_convert (operands);")
  1185.  
  1186. ;; Conversion between fixed point and floating point.
  1187. ;; Note that among the fix-to-float insns
  1188. ;; the ones that start with SImode come first.
  1189. ;; That is so that an operand that is a CONST_INT
  1190. ;; (and therefore lacks a specific machine mode).
  1191. ;; will be recognized as SImode (which is always valid)
  1192. ;; rather than as QImode or HImode.
  1193.  
  1194. (define_expand "floatsisf2"
  1195.   [(set (match_operand:SF 0 "general_operand" "")
  1196.     (float:SF (match_operand:SI 1 "general_operand" "")))]
  1197.   "TARGET_SANE || TARGET_68881"
  1198.   "")
  1199.  
  1200. (define_insn ""
  1201.   [(set (match_operand:SF 0 "general_operand" "=f")
  1202.     (float:SF (match_operand:SI 1 "general_operand" "dmi")))]
  1203.   "TARGET_68881"
  1204.   "fmove.l %1,%0")
  1205.  
  1206. (define_insn ""
  1207.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1208.     (float:SF (match_operand:SI 1 "general_operand" "ro")))]
  1209.   "TARGET_SANE"
  1210.   "* return output_sane_convert (operands);")
  1211.  
  1212. (define_expand "floatsidf2"
  1213.   [(set (match_operand:DF 0 "general_operand" "")
  1214.     (float:DF (match_operand:SI 1 "general_operand" "")))]
  1215.   "TARGET_SANE || TARGET_68881"
  1216.   "")
  1217.  
  1218. (define_insn ""
  1219.   [(set (match_operand:DF 0 "general_operand" "=f")
  1220.     (float:DF (match_operand:SI 1 "general_operand" "dmi")))]
  1221.   "TARGET_68881"
  1222.   "fmove.l %1,%0")
  1223.  
  1224. (define_insn ""
  1225.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1226.     (float:DF (match_operand:SI 1 "general_operand" "ro")))]
  1227.   "TARGET_SANE"
  1228.   "* return output_sane_convert (operands);")
  1229.  
  1230. (define_expand "floatsixf2"
  1231.   [(set (match_operand:XF 0 "general_operand" "")
  1232.     (float:XF (match_operand:SI 1 "general_operand" "")))]
  1233.   "TARGET_SANE || TARGET_68881"
  1234.   "")
  1235.  
  1236. (define_insn ""
  1237.   [(set (match_operand:XF 0 "general_operand" "=f")
  1238.     (float:XF (match_operand:SI 1 "general_operand" "dmi")))]
  1239.   "TARGET_68881"
  1240.   "fmove.l %1,%0")
  1241.  
  1242. (define_insn ""
  1243.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1244.     (float:XF (match_operand:SI 1 "general_operand" "ro")))]
  1245.   "TARGET_SANE"
  1246.   "* return output_sane_convert (operands);")
  1247.  
  1248. (define_insn "floathisf2"
  1249.   [(set (match_operand:SF 0 "general_operand" "=f")
  1250.     (float:SF (match_operand:HI 1 "general_operand" "dmn")))]
  1251.   "TARGET_68881"
  1252.   "fmove.w %1,%0")
  1253.  
  1254. (define_insn "floathidf2"
  1255.   [(set (match_operand:DF 0 "general_operand" "=f")
  1256.     (float:DF (match_operand:HI 1 "general_operand" "dmn")))]
  1257.   "TARGET_68881"
  1258.   "fmove.w %1,%0")
  1259.  
  1260. (define_insn "floathixf2"
  1261.   [(set (match_operand:XF 0 "general_operand" "=f")
  1262.     (float:XF (match_operand:HI 1 "general_operand" "dmn")))]
  1263.   "TARGET_68881"
  1264.   "fmove.w %1,%0")
  1265.  
  1266. (define_insn "floatqisf2"
  1267.   [(set (match_operand:SF 0 "general_operand" "=f")
  1268.     (float:SF (match_operand:QI 1 "general_operand" "dmn")))]
  1269.   "TARGET_68881"
  1270.   "fmove.b %1,%0")
  1271.  
  1272. (define_insn "floatqidf2"
  1273.   [(set (match_operand:DF 0 "general_operand" "=f")
  1274.     (float:DF (match_operand:QI 1 "general_operand" "dmn")))]
  1275.   "TARGET_68881"
  1276.   "fmove.b %1,%0")
  1277.  
  1278. (define_insn "floatqixf2"
  1279.   [(set (match_operand:XF 0 "general_operand" "=f")
  1280.     (float:XF (match_operand:QI 1 "general_operand" "dmn")))]
  1281.   "TARGET_68881"
  1282.   "fmove.b %1,%0")
  1283.  
  1284. ;; Convert a float to a float whose value is an integer.
  1285. ;; This is the first stage of converting it to an integer type.
  1286.  
  1287. (define_expand "ftruncsf2"
  1288.   [(set (match_operand:SF 0 "general_operand" "")
  1289.     (fix:SF (match_operand:SF 1 "general_operand" "")))]
  1290.   "TARGET_SANE || TARGET_68881"
  1291.   "")
  1292.  
  1293. (define_insn ""
  1294.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1295.     (fix:SF (match_operand:SF 1 "general_operand" "0")))]
  1296.   "TARGET_SANE"
  1297.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  1298.  
  1299. (define_insn ""
  1300.   [(set (match_operand:SF 0 "general_operand" "=f")
  1301.     (fix:SF (match_operand:SF 1 "general_operand" "dfmF")))]
  1302.   "TARGET_68881"
  1303.   "*
  1304. {
  1305.   if (FP_REG_P (operands[1]))
  1306.     return \"fintrz.x %1,%0\";
  1307.   return \"fintrz.s %1,%0\";
  1308. }")
  1309.  
  1310. (define_expand "ftruncdf2"
  1311.   [(set (match_operand:DF 0 "general_operand" "")
  1312.     (fix:DF (match_operand:DF 1 "general_operand" "")))]
  1313.   "TARGET_SANE || TARGET_68881"
  1314.   "")
  1315.  
  1316. (define_insn ""
  1317.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1318.     (fix:DF (match_operand:DF 1 "general_operand" "0")))]
  1319.   "TARGET_SANE"
  1320.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  1321.  
  1322. (define_insn ""
  1323.   [(set (match_operand:DF 0 "general_operand" "=f")
  1324.     (fix:DF (match_operand:DF 1 "general_operand" "fmF")))]
  1325.   "TARGET_68881"
  1326.   "*
  1327. {
  1328.   if (FP_REG_P (operands[1]))
  1329.     return \"fintrz.x %1,%0\";
  1330.   return \"fintrz.d %1,%0\";
  1331. }")
  1332.  
  1333. (define_expand "ftruncxf2"
  1334.   [(set (match_operand:XF 0 "general_operand" "")
  1335.     (fix:XF (match_operand:XF 1 "general_operand" "")))]
  1336.   "TARGET_SANE || TARGET_68881"
  1337.   "")
  1338.  
  1339. (define_insn ""
  1340.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1341.     (fix:XF (match_operand:XF 1 "general_operand" "0")))]
  1342.   "TARGET_SANE"
  1343.   "* return output_sane_2 (operands, 0x0016, \"FTINTX\");")
  1344.  
  1345. (define_insn ""
  1346.   [(set (match_operand:XF 0 "general_operand" "=f")
  1347.     (fix:XF (match_operand:XF 1 "general_operand" "fmF")))]
  1348.   "TARGET_68881"
  1349.   "fintrz.x %1,%0")
  1350.  
  1351. ;; Convert a float whose value is an integer
  1352. ;; to an actual integer.  Second stage of converting float to integer type.
  1353.  
  1354. (define_insn "fixsfqi2"
  1355.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1356.     (fix:QI (match_operand:SF 1 "general_operand" "f")))]
  1357.   "TARGET_68881"
  1358.   "fmove.b %1,%0")
  1359.  
  1360. (define_insn "fixsfhi2"
  1361.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1362.     (fix:HI (match_operand:SF 1 "general_operand" "f")))]
  1363.   "TARGET_68881"
  1364.   "fmove.w %1,%0")
  1365.  
  1366. (define_insn "fixsfsi2"
  1367.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1368.     (fix:SI (match_operand:SF 1 "general_operand" "f")))]
  1369.   "TARGET_68881"
  1370.   "fmove.l %1,%0")
  1371.  
  1372. (define_insn "fixdfqi2"
  1373.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1374.     (fix:QI (match_operand:DF 1 "general_operand" "f")))]
  1375.   "TARGET_68881"
  1376.   "fmove.b %1,%0")
  1377.  
  1378. (define_insn "fixdfhi2"
  1379.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1380.     (fix:HI (match_operand:DF 1 "general_operand" "f")))]
  1381.   "TARGET_68881"
  1382.   "fmove.w %1,%0")
  1383.  
  1384. (define_insn "fixdfsi2"
  1385.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1386.     (fix:SI (match_operand:DF 1 "general_operand" "f")))]
  1387.   "TARGET_68881"
  1388.   "fmove.l %1,%0")
  1389.  
  1390. (define_insn "fixxfqi2"
  1391.   [(set (match_operand:QI 0 "general_operand" "=dm")
  1392.     (fix:QI (match_operand:XF 1 "general_operand" "f")))]
  1393.   "TARGET_68881"
  1394.   "fmove.b %1,%0")
  1395.  
  1396. (define_insn "fixxfhi2"
  1397.   [(set (match_operand:HI 0 "general_operand" "=dm")
  1398.     (fix:HI (match_operand:XF 1 "general_operand" "f")))]
  1399.   "TARGET_68881"
  1400.   "fmove.w %1,%0")
  1401.  
  1402. (define_expand "fixxfsi2"
  1403.   [(set (match_operand:SI 0 "general_operand" "")
  1404.     (fix:SI (match_operand:XF 1 "general_operand" "")))]
  1405.   "TARGET_SANE || TARGET_68881"
  1406.   "")
  1407.  
  1408. (define_insn ""
  1409.   [(set (match_operand:SI 0 "general_operand" "=do")
  1410.     (fix:SI (match_operand:XF 1 "general_operand" "ro")))]
  1411.   "TARGET_SANE"
  1412.   "* return output_lib_convert(operands, \"_XTOI\");")
  1413.  
  1414. (define_insn ""
  1415.   [(set (match_operand:SI 0 "general_operand" "=dm")
  1416.     (fix:SI (match_operand:XF 1 "general_operand" "f")))]
  1417.   "TARGET_68881"
  1418.   "fmove.l %1,%0")
  1419.  
  1420. ;(define_expand "fixunsdfsi2"
  1421. ;  [(set (match_operand:SI 0 "general_operand" "")
  1422. ;    (unsigned_fix:SI (match_operand:DF 1 "general_operand" "")))]
  1423. ;  "TARGET_SANE || TARGET_68881"
  1424. ;  "")
  1425.  
  1426. (define_expand "fixunsxfsi2"
  1427.   [(set (match_operand:SI 0 "general_operand" "")
  1428.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "")))]
  1429.   "TARGET_SANE || TARGET_68881"
  1430.   "")
  1431.  
  1432. (define_insn ""
  1433.   [(set (match_operand:SI 0 "general_operand" "=do")
  1434.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "ro")))]
  1435.   "TARGET_SANE"
  1436.   "* return output_lib_convert(operands, \"_XTOU\");")
  1437.  
  1438. (define_insn ""
  1439.   [(set (match_operand:SI 0 "general_operand" "=do")
  1440.     (unsigned_fix:SI (match_operand:XF 1 "general_operand" "f")))]
  1441.   "TARGET_68881"
  1442.   "* return output_lib_convert(operands, \"_X96TOU\");")
  1443.  
  1444. ;; add instructions
  1445.  
  1446. ;; Note that the last two alternatives are near-duplicates
  1447. ;; in order to handle insns generated by reload.
  1448. ;; This is needed since they are not themselves reloaded,
  1449. ;; so commutativity won't apply to them.
  1450. (define_insn "addsi3"
  1451.   [(set (match_operand:SI 0 "general_operand" "=m,r,!a,!a")
  1452.     (plus:SI (match_operand:SI 1 "general_operand" "%0,0,a,rJK")
  1453.          (match_operand:SI 2 "general_operand" "dIKLM,mrIKLM,rJK,a")))]
  1454.   ""
  1455.   "*
  1456. {
  1457.   if (! operands_match_p (operands[0], operands[1]))
  1458.     {
  1459.       if (!ADDRESS_REG_P (operands[1]))
  1460.     {
  1461.       rtx tmp = operands[1];
  1462.  
  1463.       operands[1] = operands[2];
  1464.       operands[2] = tmp;
  1465.     }
  1466.  
  1467.       /* These insns can result from reloads to access
  1468.      stack slots over 64k from the frame pointer.  */
  1469.       if (GET_CODE (operands[2]) == CONST_INT
  1470.       && INTVAL (operands[2]) + 0x8000 >= (unsigned) 0x10000)
  1471.         return \"move.l %2,%0\;add.l %1,%0\";
  1472.       if (GET_CODE (operands[2]) == REG)
  1473.     return \"lea (%1,%2.l),%0\";
  1474.       else
  1475.     return \"lea (%c2,%1),%0\";
  1476.     }
  1477.   if (GET_CODE (operands[2]) == CONST_INT)
  1478.     {
  1479.       if (INTVAL (operands[2]) > 0
  1480.       && INTVAL (operands[2]) <= 8)
  1481.     return (ADDRESS_REG_P (operands[0])
  1482.         ? \"addq.w %2,%0\"
  1483.         : \"addq.l %2,%0\");
  1484.       if (INTVAL (operands[2]) < 0
  1485.       && INTVAL (operands[2]) >= -8)
  1486.         {
  1487.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1488.                      - INTVAL (operands[2]));
  1489.       return (ADDRESS_REG_P (operands[0])
  1490.           ? \"subq.w %2,%0\"
  1491.           : \"subq.l %2,%0\");
  1492.     }
  1493.       if (ADDRESS_REG_P (operands[0])
  1494.       && INTVAL (operands[2]) >= -0x8000
  1495.       && INTVAL (operands[2]) < 0x8000)
  1496.     return \"add.w %2,%0\";
  1497.     }
  1498.   return \"add.l %2,%0\";
  1499. }")
  1500.  
  1501. (define_insn ""
  1502.   [(set (match_operand:SI 0 "general_operand" "=a")
  1503.     (plus:SI (match_operand:SI 1 "general_operand" "0")
  1504.          (sign_extend:SI (match_operand:HI 2 "general_operand" "rmn"))))]
  1505.   ""
  1506.   "add.w %2,%0")
  1507.  
  1508. (define_insn "addhi3"
  1509.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  1510.     (plus:HI (match_operand:HI 1 "general_operand" "%0,0")
  1511.          (match_operand:HI 2 "general_operand" "dn,rmn")))]
  1512.   ""
  1513.   "*
  1514. {
  1515.   if (GET_CODE (operands[2]) == CONST_INT)
  1516.     {
  1517.       if (INTVAL (operands[2]) > 0
  1518.       && INTVAL (operands[2]) <= 8)
  1519.     return \"addq.w %2,%0\";
  1520.     }
  1521.   if (GET_CODE (operands[2]) == CONST_INT)
  1522.     {
  1523.       if (INTVAL (operands[2]) < 0
  1524.       && INTVAL (operands[2]) >= -8)
  1525.     {
  1526.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  1527.                      - INTVAL (operands[2]));
  1528.       return \"subq.w %2,%0\";
  1529.     }
  1530.     }
  1531.   return \"add.w %2,%0\";
  1532. }")
  1533.  
  1534. (define_insn ""
  1535.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1536.     (plus:HI (match_dup 0)
  1537.          (match_operand:HI 1 "general_operand" "dn,rmn")))]
  1538.   ""
  1539.   "add.w %1,%0")
  1540.  
  1541. (define_insn "addqi3"
  1542.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  1543.     (plus:QI (match_operand:QI 1 "general_operand" "%0,0")
  1544.          (match_operand:QI 2 "general_operand" "dn,dmn")))]
  1545.   ""
  1546.   "*
  1547. {
  1548.   if (GET_CODE (operands[2]) == CONST_INT)
  1549.     {
  1550.       if (INTVAL (operands[2]) > 0
  1551.       && INTVAL (operands[2]) <= 8)
  1552.     return \"addq.b %2,%0\";
  1553.     }
  1554.   if (GET_CODE (operands[2]) == CONST_INT)
  1555.     {
  1556.       if (INTVAL (operands[2]) < 0 && INTVAL (operands[2]) >= -8)
  1557.        {
  1558.      operands[2] = gen_rtx (CONST_INT, VOIDmode, - INTVAL (operands[2]));
  1559.      return \"subq.b %2,%0\";
  1560.        }
  1561.     }
  1562.   return \"add.b %2,%0\";
  1563. }")
  1564.  
  1565. (define_insn ""
  1566.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  1567.     (plus:QI (match_dup 0)
  1568.          (match_operand:QI 1 "general_operand" "dn,dmn")))]
  1569.   ""
  1570.   "add.b %1,%0")
  1571.  
  1572. (define_expand "addsf3"
  1573.   [(set (match_operand:SF 0 "general_operand" "")
  1574.     (plus:SF (match_operand:SF 1 "general_operand" "")
  1575.          (match_operand:SF 2 "general_operand" "")))]
  1576.   "TARGET_SANE || TARGET_68881"
  1577.   "")
  1578.  
  1579. (define_insn ""
  1580.   [(set (match_operand:SF 0 "general_operand" "=f")
  1581.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  1582.          (match_operand:SF 2 "general_operand" "dfmF")))]
  1583.   "TARGET_68881"
  1584.   "*
  1585. {
  1586.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  1587.     return \"fadd.x %2,%0\";
  1588.   return \"fadd.s %2,%0\";
  1589. }")
  1590.  
  1591. (define_insn ""
  1592.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1593.     (plus:SF (match_operand:SF 1 "general_operand" "%0")
  1594.          (match_operand:SF 2 "general_operand" "ro")))]
  1595.   "TARGET_SANE"
  1596.   "* return output_sane_3 (operands, 0x1000, \"FADDS\");")
  1597.  
  1598. (define_expand "adddf3"
  1599.   [(set (match_operand:DF 0 "general_operand" "")
  1600.     (plus:DF (match_operand:DF 1 "general_operand" "")
  1601.          (match_operand:DF 2 "general_operand" "")))]
  1602.   "TARGET_SANE || TARGET_68881"
  1603.   "")
  1604.  
  1605. (define_insn ""
  1606.   [(set (match_operand:DF 0 "general_operand" "=f")
  1607.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  1608.          (match_operand:DF 2 "general_operand" "fmF")))]
  1609.   "TARGET_68881"
  1610.   "*
  1611. {
  1612.   if (REG_P (operands[2]))
  1613.     return \"fadd.x %2,%0\";
  1614.   return \"fadd.d %2,%0\";
  1615. }")
  1616.  
  1617. (define_insn ""
  1618.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1619.     (plus:DF (match_operand:DF 1 "general_operand" "%0")
  1620.          (match_operand:DF 2 "general_operand" "ro")))]
  1621.   "TARGET_SANE"
  1622.   "* return output_sane_3 (operands, 0x0800, \"FADDD\");")
  1623.  
  1624. (define_expand "addxf3"
  1625.   [(set (match_operand:XF 0 "general_operand" "")
  1626.     (plus:XF (match_operand:XF 1 "general_operand" "")
  1627.          (match_operand:XF 2 "general_operand" "")))]
  1628.   "TARGET_SANE || TARGET_68881"
  1629.   "")
  1630.  
  1631. (define_insn ""
  1632.   [(set (match_operand:XF 0 "general_operand" "=f")
  1633.     (plus:XF (match_operand:XF 1 "general_operand" "%0")
  1634.          (match_operand:XF 2 "general_operand" "fmG")))]
  1635.   "TARGET_68881"
  1636.   "fadd.x %2,%0")
  1637.  
  1638. (define_insn ""
  1639.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1640.     (plus:XF (match_operand:XF 1 "general_operand" "%0")
  1641.          (match_operand:XF 2 "general_operand" "ro")))]
  1642.   "TARGET_SANE"
  1643.   "* return output_sane_3 (operands, 0x0000, \"FADDX\");")
  1644.  
  1645. ;; subtract instructions
  1646.  
  1647. (define_insn "subsi3"
  1648.   [(set (match_operand:SI 0 "general_operand" "=m,r,!a,?d")
  1649.     (minus:SI (match_operand:SI 1 "general_operand" "0,0,a,mrIKs")
  1650.           (match_operand:SI 2 "general_operand" "dIKs,mrIKs,J,0")))]
  1651.   ""
  1652.   "*
  1653. {
  1654.   if (! operands_match_p (operands[0], operands[1]))
  1655.     {
  1656.       if (operands_match_p (operands[0], operands[2]))
  1657.     {
  1658.       if (GET_CODE (operands[1]) == CONST_INT)
  1659.         {
  1660.           if (INTVAL (operands[1]) > 0
  1661.           && INTVAL (operands[1]) <= 8)
  1662.         return \"subq.l %1,%0\;neg.l %0\";
  1663.         }
  1664.       return \"sub.l %1,%0\;neg.l %0\";
  1665.     }
  1666.       /* This case is matched by J, but negating -0x8000
  1667.          in an lea would give an invalid displacement.
  1668.      So do this specially.  */
  1669.       if (INTVAL (operands[2]) == -0x8000)
  1670.     return \"move.l %1,%0\;sub.l %2,%0\";
  1671.       return \"lea (%n2,%1),%0\";
  1672.     }
  1673.   if (GET_CODE (operands[2]) == CONST_INT)
  1674.     {
  1675.       if (INTVAL (operands[2]) > 0
  1676.       && INTVAL (operands[2]) <= 8)
  1677.     return \"subq.l %2,%0\";
  1678.       if (ADDRESS_REG_P (operands[0])
  1679.       && INTVAL (operands[2]) >= -0x8000
  1680.       && INTVAL (operands[2]) < 0x8000)
  1681.     return \"sub.w %2,%0\";
  1682.     }
  1683.   if (GET_CODE (operands[2]) == SYMBOL_REF)
  1684.     {
  1685.       return \"pea %a2\;sub.l (sp)+,%0\";
  1686.     }
  1687.   return \"sub.l %2,%0\";
  1688. }")
  1689.  
  1690. (define_insn ""
  1691.   [(set (match_operand:SI 0 "general_operand" "=a")
  1692.     (minus:SI (match_operand:SI 1 "general_operand" "0")
  1693.           (sign_extend:SI (match_operand:HI 2 "general_operand" "rmn"))))]
  1694.   ""
  1695.   "sub.w %2,%0")
  1696.  
  1697. (define_insn "subhi3"
  1698.   [(set (match_operand:HI 0 "general_operand" "=m,r")
  1699.     (minus:HI (match_operand:HI 1 "general_operand" "0,0")
  1700.           (match_operand:HI 2 "general_operand" "dn,rmn")))]
  1701.   ""
  1702.   "sub.w %2,%0")
  1703.  
  1704. (define_insn ""
  1705.   [(set (strict_low_part (match_operand:HI 0 "general_operand" "+m,d"))
  1706.     (minus:HI (match_dup 0)
  1707.           (match_operand:HI 1 "general_operand" "dn,rmn")))]
  1708.   ""
  1709.   "sub.w %1,%0")
  1710.  
  1711. (define_insn "subqi3"
  1712.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  1713.     (minus:QI (match_operand:QI 1 "general_operand" "0,0")
  1714.           (match_operand:QI 2 "general_operand" "dn,dmn")))]
  1715.   ""
  1716.   "sub.b %2,%0")
  1717.  
  1718. (define_insn ""
  1719.   [(set (strict_low_part (match_operand:QI 0 "general_operand" "+m,d"))
  1720.     (minus:QI (match_dup 0)
  1721.           (match_operand:QI 1 "general_operand" "dn,dmn")))]
  1722.   ""
  1723.   "sub.b %1,%0")
  1724.  
  1725. (define_expand "subsf3"
  1726.   [(set (match_operand:SF 0 "general_operand" "")
  1727.     (minus:SF (match_operand:SF 1 "general_operand" "")
  1728.           (match_operand:SF 2 "general_operand" "")))]
  1729.   "TARGET_SANE || TARGET_68881"
  1730.   "")
  1731.  
  1732. (define_insn ""
  1733.   [(set (match_operand:SF 0 "general_operand" "=f")
  1734.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  1735.           (match_operand:SF 2 "general_operand" "dfmF")))]
  1736.   "TARGET_68881"
  1737.   "*
  1738. {
  1739.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  1740.     return \"fsub.x %2,%0\";
  1741.   return \"fsub.s %2,%0\";
  1742. }")
  1743.  
  1744. (define_insn ""
  1745.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1746.     (minus:SF (match_operand:SF 1 "general_operand" "0")
  1747.           (match_operand:SF 2 "general_operand" "ro")))]
  1748.   "TARGET_SANE"
  1749.   "* return output_sane_3 (operands, 0x1002, \"FSUBS\");")
  1750.  
  1751. (define_expand "subdf3"
  1752.   [(set (match_operand:DF 0 "general_operand" "")
  1753.     (minus:DF (match_operand:DF 1 "general_operand" "")
  1754.           (match_operand:DF 2 "general_operand" "")))]
  1755.   "TARGET_SANE || TARGET_68881"
  1756.   "")
  1757.  
  1758. (define_insn ""
  1759.   [(set (match_operand:DF 0 "general_operand" "=f")
  1760.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  1761.           (match_operand:DF 2 "general_operand" "fmF")))]
  1762.   "TARGET_68881"
  1763.   "*
  1764. {
  1765.   if (REG_P (operands[2]))
  1766.     return \"fsub.x %2,%0\";
  1767.   return \"fsub.d %2,%0\";
  1768. }")
  1769.  
  1770. (define_insn ""
  1771.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1772.     (minus:DF (match_operand:DF 1 "general_operand" "0")
  1773.           (match_operand:DF 2 "general_operand" "ro")))]
  1774.   "TARGET_SANE"
  1775.   "* return output_sane_3 (operands, 0x0802, \"FSUBD\");")
  1776.  
  1777. (define_expand "subxf3"
  1778.   [(set (match_operand:XF 0 "general_operand" "")
  1779.     (minus:XF (match_operand:XF 1 "general_operand" "")
  1780.           (match_operand:XF 2 "general_operand" "")))]
  1781.   "TARGET_SANE || TARGET_68881"
  1782.   "")
  1783.  
  1784. (define_insn ""
  1785.   [(set (match_operand:XF 0 "general_operand" "=f")
  1786.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  1787.           (match_operand:XF 2 "general_operand" "fmG")))]
  1788.   "TARGET_68881"
  1789.   "fsub.x %2,%0")
  1790.  
  1791. (define_insn ""
  1792.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1793.     (minus:XF (match_operand:XF 1 "general_operand" "0")
  1794.           (match_operand:XF 2 "general_operand" "ro")))]
  1795.   "TARGET_SANE"
  1796.   "* return output_sane_3 (operands, 0x0002, \"FSUBX\");")
  1797.  
  1798. ;; multiply instructions
  1799.  
  1800. (define_insn "mulhi3"
  1801.   [(set (match_operand:HI 0 "general_operand" "=d")
  1802.     (mult:HI (match_operand:HI 1 "general_operand" "%0")
  1803.          (match_operand:HI 2 "general_operand" "dmn")))]
  1804.   ""
  1805.   "muls.w %2,%0")
  1806.  
  1807. (define_insn "mulhisi3"
  1808.   [(set (match_operand:SI 0 "general_operand" "=d")
  1809.     (mult:SI (match_operand:HI 1 "general_operand" "%0")
  1810.          (match_operand:HI 2 "general_operand" "dmn")))]
  1811.   ""
  1812.   "muls.w %2,%0")
  1813.  
  1814. (define_expand "mulsi3"
  1815.   [(set (match_operand:SI 0 "general_operand" "")
  1816.     (mult:SI (match_operand:SI 1 "general_operand" "")
  1817.          (match_operand:SI 2 "general_operand" "")))]
  1818.   "TARGET_INTLIB || TARGET_68020"
  1819.   "")
  1820.  
  1821. (define_insn ""
  1822.   [(set (match_operand:SI 0 "general_operand" "=d")
  1823.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  1824.          (match_operand:SI 2 "general_operand" "dmsK")))]
  1825.   "TARGET_68020"
  1826.   "muls.l %2,%0")
  1827.  
  1828. (define_insn ""
  1829.   [(set (match_operand:SI 0 "general_operand" "=d")
  1830.     (mult:SI (match_operand:SI 1 "general_operand" "%0")
  1831.          (match_operand:SI 2 "general_operand" "dsK")))]
  1832.   "TARGET_INTLIB"
  1833.   "* return output_int_lib_call (operands, \"ULMULT\");")
  1834.  
  1835. (define_insn "umulhi3"
  1836.   [(set (match_operand:HI 0 "general_operand" "=d")
  1837.     (umult:HI (match_operand:HI 1 "general_operand" "%0")
  1838.           (match_operand:HI 2 "general_operand" "dmn")))]
  1839.   ""
  1840.   "mulu.w %2,%0")
  1841.  
  1842. (define_insn "umulhisi3"
  1843.   [(set (match_operand:SI 0 "general_operand" "=d")
  1844.     (umult:SI (match_operand:HI 1 "general_operand" "%0")
  1845.           (match_operand:HI 2 "general_operand" "dmn")))]
  1846.   ""
  1847.   "mulu.w %2,%0")
  1848.  
  1849. (define_expand "umulsi3"
  1850.   [(set (match_operand:SI 0 "general_operand" "")
  1851.     (umult:SI (match_operand:SI 1 "general_operand" "")
  1852.           (match_operand:SI 2 "general_operand" "")))]
  1853.   "TARGET_INTLIB || TARGET_68020"
  1854.   "")
  1855.  
  1856. (define_insn ""
  1857.   [(set (match_operand:SI 0 "general_operand" "=d")
  1858.     (umult:SI (match_operand:SI 1 "general_operand" "%0")
  1859.           (match_operand:SI 2 "general_operand" "dmsK")))]
  1860.   "TARGET_68020"
  1861.   "mulu.l %2,%0")
  1862.  
  1863. (define_insn ""
  1864.   [(set (match_operand:SI 0 "general_operand" "=d")
  1865.     (umult:SI (match_operand:SI 1 "general_operand" "%0")
  1866.           (match_operand:SI 2 "general_operand" "dsK")))]
  1867.   "TARGET_INTLIB"
  1868.   "* return output_int_lib_call (operands, \"ULMULT\");")
  1869.  
  1870. (define_expand "mulsf3"
  1871.   [(set (match_operand:SF 0 "general_operand" "")
  1872.     (mult:SF (match_operand:SF 1 "general_operand" "")
  1873.          (match_operand:SF 2 "general_operand" "")))]
  1874.   "TARGET_SANE || TARGET_68881"
  1875.   "")
  1876.  
  1877. (define_insn ""
  1878.   [(set (match_operand:SF 0 "general_operand" "=f")
  1879.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  1880.          (match_operand:SF 2 "general_operand" "dfmF")))]
  1881.   "TARGET_68881"
  1882.   "*
  1883. {
  1884.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  1885.     return \"fsglmul.x %2,%0\";
  1886.   return \"fsglmul.s %2,%0\";
  1887. }")
  1888.  
  1889. (define_insn ""
  1890.   [(set (match_operand:SF 0 "general_operand" "=ro")
  1891.     (mult:SF (match_operand:SF 1 "general_operand" "%0")
  1892.          (match_operand:SF 2 "general_operand" "ro")))]
  1893.   "TARGET_SANE"
  1894.   "* return output_sane_3 (operands, 0x1004, \"FMULS\");")
  1895.  
  1896. (define_expand "muldf3"
  1897.   [(set (match_operand:DF 0 "general_operand" "")
  1898.     (mult:DF (match_operand:DF 1 "general_operand" "")
  1899.          (match_operand:DF 2 "general_operand" "")))]
  1900.   "TARGET_SANE || TARGET_68881"
  1901.   "")
  1902.  
  1903. (define_insn ""
  1904.   [(set (match_operand:DF 0 "general_operand" "=f")
  1905.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  1906.          (match_operand:DF 2 "general_operand" "fmF")))]
  1907.   "TARGET_68881"
  1908.   "*
  1909. {
  1910.   if (REG_P (operands[2]))
  1911.     return \"fmul.x %2,%0\";
  1912.   return \"fmul.d %2,%0\";
  1913. }")
  1914.  
  1915. (define_insn ""
  1916.   [(set (match_operand:DF 0 "general_operand" "=ro")
  1917.     (mult:DF (match_operand:DF 1 "general_operand" "%0")
  1918.          (match_operand:DF 2 "general_operand" "ro")))]
  1919.   "TARGET_SANE"
  1920.   "* return output_sane_3 (operands, 0x0804, \"FMULD\");")
  1921.  
  1922. (define_expand "mulxf3"
  1923.   [(set (match_operand:XF 0 "general_operand" "")
  1924.     (mult:XF (match_operand:XF 1 "general_operand" "")
  1925.          (match_operand:XF 2 "general_operand" "")))]
  1926.   "TARGET_SANE || TARGET_68881"
  1927.   "")
  1928.  
  1929. (define_insn ""
  1930.   [(set (match_operand:XF 0 "general_operand" "=f")
  1931.     (mult:XF (match_operand:XF 1 "general_operand" "%0")
  1932.          (match_operand:XF 2 "general_operand" "fmG")))]
  1933.   "TARGET_68881"
  1934.   "fmul.x %2,%0")
  1935.  
  1936. (define_insn ""
  1937.   [(set (match_operand:XF 0 "general_operand" "=ro")
  1938.     (mult:XF (match_operand:XF 1 "general_operand" "%0")
  1939.          (match_operand:XF 2 "general_operand" "ro")))]
  1940.   "TARGET_SANE"
  1941.   "* return output_sane_3 (operands, 0x0004, \"FMULX\");")
  1942.  
  1943. ;; divide instructions
  1944.  
  1945. (define_insn "divhi3"
  1946.   [(set (match_operand:HI 0 "general_operand" "=d")
  1947.     (div:HI (match_operand:HI 1 "general_operand" "0")
  1948.         (match_operand:HI 2 "general_operand" "dmn")))]
  1949.   ""
  1950.   "ext.l %0\;divs.w %2,%0")
  1951.  
  1952. (define_insn "divhisi3"
  1953.   [(set (match_operand:HI 0 "general_operand" "=d")
  1954.     (div:HI (match_operand:SI 1 "general_operand" "0")
  1955.         (match_operand:HI 2 "general_operand" "dmn")))]
  1956.   ""
  1957.   "divs.w %2,%0")
  1958.  
  1959. (define_expand "divsi3"
  1960.   [(set (match_operand:SI 0 "general_operand" "")
  1961.     (div:SI (match_operand:SI 1 "general_operand" "")
  1962.         (match_operand:SI 2 "general_operand" "")))]
  1963.   "TARGET_INTLIB || TARGET_68020"
  1964.   "")
  1965.  
  1966. (define_insn ""
  1967.   [(set (match_operand:SI 0 "general_operand" "=d")
  1968.     (div:SI (match_operand:SI 1 "general_operand" "0")
  1969.         (match_operand:SI 2 "general_operand" "dmsK")))]
  1970.   "TARGET_68020"
  1971.   "divs.l %2,%0")
  1972.  
  1973. (define_insn ""
  1974.   [(set (match_operand:SI 0 "general_operand" "=d")
  1975.     (div:SI (match_operand:SI 1 "general_operand" "0")
  1976.         (match_operand:SI 2 "general_operand" "dsK")))]
  1977.   "TARGET_INTLIB"
  1978.   "* return output_int_lib_call (operands, \"LDIVT\");")
  1979.  
  1980. (define_insn "udivhi3"
  1981.   [(set (match_operand:HI 0 "general_operand" "=d")
  1982.     (udiv:HI (match_operand:HI 1 "general_operand" "0")
  1983.          (match_operand:HI 2 "general_operand" "dmn")))]
  1984.   ""
  1985.   "and.l #$FFFF,%0\;divu.w %2,%0")
  1986.  
  1987. (define_insn "udivhisi3"
  1988.   [(set (match_operand:HI 0 "general_operand" "=d")
  1989.     (udiv:HI (match_operand:SI 1 "general_operand" "0")
  1990.          (match_operand:HI 2 "general_operand" "dmn")))]
  1991.   ""
  1992.   "divu.w %2,%0")
  1993.  
  1994. (define_expand "udivsi3"
  1995.   [(set (match_operand:SI 0 "general_operand" "")
  1996.     (udiv:SI (match_operand:SI 1 "general_operand" "")
  1997.          (match_operand:SI 2 "general_operand" "")))]
  1998.   "TARGET_INTLIB || TARGET_68020"
  1999.   "")
  2000.  
  2001. (define_insn ""
  2002.   [(set (match_operand:SI 0 "general_operand" "=d")
  2003.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2004.          (match_operand:SI 2 "general_operand" "dmsK")))]
  2005.   "TARGET_68020"
  2006.   "divu.l %2,%0")
  2007.  
  2008. (define_insn ""
  2009.   [(set (match_operand:SI 0 "general_operand" "=d")
  2010.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2011.          (match_operand:SI 2 "general_operand" "dsK")))]
  2012.   "TARGET_INTLIB"
  2013.   "* return output_int_lib_call (operands, \"ULDIVT\");")
  2014.  
  2015. (define_expand "divsf3"
  2016.   [(set (match_operand:SF 0 "general_operand" "")
  2017.     (div:SF (match_operand:SF 1 "general_operand" "")
  2018.          (match_operand:SF 2 "general_operand" "")))]
  2019.   "TARGET_SANE || TARGET_68881"
  2020.   "")
  2021.  
  2022. (define_insn ""
  2023.   [(set (match_operand:SF 0 "general_operand" "=f")
  2024.     (div:SF (match_operand:SF 1 "general_operand" "0")
  2025.          (match_operand:SF 2 "general_operand" "dfmF")))]
  2026.   "TARGET_68881"
  2027.   "*
  2028. {
  2029.   if (REG_P (operands[2]) && ! DATA_REG_P (operands[2]))
  2030.     return \"fsgldiv.x %2,%0\";
  2031.   return \"fsgldiv.s %2,%0\";
  2032. }")
  2033.  
  2034. (define_insn ""
  2035.   [(set (match_operand:SF 0 "general_operand" "=ro")
  2036.     (div:SF (match_operand:SF 1 "general_operand" "0")
  2037.          (match_operand:SF 2 "general_operand" "ro")))]
  2038.   "TARGET_SANE"
  2039.   "* return output_sane_3 (operands, 0x1006, \"FDIVS\");")
  2040.  
  2041. (define_expand "divdf3"
  2042.   [(set (match_operand:DF 0 "general_operand" "")
  2043.     (div:DF (match_operand:DF 1 "general_operand" "")
  2044.          (match_operand:DF 2 "general_operand" "")))]
  2045.   "TARGET_SANE || TARGET_68881"
  2046.   "")
  2047.  
  2048. (define_insn ""
  2049.   [(set (match_operand:DF 0 "general_operand" "=f")
  2050.     (div:DF (match_operand:DF 1 "general_operand" "0")
  2051.          (match_operand:DF 2 "general_operand" "fmG")))]
  2052.   "TARGET_68881"
  2053.   "*
  2054. {
  2055.   if (REG_P (operands[2]))
  2056.     return \"fdiv.x %2,%0\";
  2057.   return \"fdiv.d %2,%0\";
  2058. }")
  2059.  
  2060. (define_insn ""
  2061.   [(set (match_operand:DF 0 "general_operand" "=ro")
  2062.     (div:DF (match_operand:DF 1 "general_operand" "0")
  2063.          (match_operand:DF 2 "general_operand" "ro")))]
  2064.   "TARGET_SANE"
  2065.   "* return output_sane_3 (operands, 0x0806, \"FDIVD\");")
  2066.  
  2067. (define_expand "divxf3"
  2068.   [(set (match_operand:XF 0 "general_operand" "")
  2069.     (div:XF (match_operand:XF 1 "general_operand" "")
  2070.          (match_operand:XF 2 "general_operand" "")))]
  2071.   "TARGET_SANE || TARGET_68881"
  2072.   "")
  2073.  
  2074. (define_insn ""
  2075.   [(set (match_operand:XF 0 "general_operand" "=f")
  2076.     (div:XF (match_operand:XF 1 "general_operand" "0")
  2077.          (match_operand:XF 2 "general_operand" "fmG")))]
  2078.   "TARGET_68881"
  2079.   "fdiv.x %2,%0")
  2080.  
  2081. (define_insn ""
  2082.   [(set (match_operand:XF 0 "general_operand" "=ro")
  2083.     (div:XF (match_operand:XF 1 "general_operand" "0")
  2084.          (match_operand:XF 2 "general_operand" "ro")))]
  2085.   "TARGET_SANE"
  2086.   "* return output_sane_3 (operands, 0x0006, \"FDIVX\");")
  2087.  
  2088. ;; Remainder instructions.
  2089.  
  2090. (define_insn "modhi3"
  2091.   [(set (match_operand:HI 0 "general_operand" "=d")
  2092.     (mod:HI (match_operand:HI 1 "general_operand" "0")
  2093.         (match_operand:HI 2 "general_operand" "dmn")))]
  2094.   ""
  2095.   "*
  2096. {
  2097.   /* The swap insn produces cc's that don't correspond to the result.  */
  2098.   CC_STATUS_INIT;
  2099.   return \"ext.l %0\;divs.w %2,%0\;swap %0\";
  2100. }")
  2101.  
  2102. (define_insn "modhisi3"
  2103.   [(set (match_operand:HI 0 "general_operand" "=d")
  2104.     (mod:HI (match_operand:SI 1 "general_operand" "0")
  2105.         (match_operand:HI 2 "general_operand" "dmn")))]
  2106.   ""
  2107.   "*
  2108. {
  2109.   /* The swap insn produces cc's that don't correspond to the result.  */
  2110.   CC_STATUS_INIT;
  2111.   return \"divs.w %2,%0\;swap %0\";
  2112. }")
  2113.  
  2114. (define_insn "umodhi3"
  2115.   [(set (match_operand:HI 0 "general_operand" "=d")
  2116.     (umod:HI (match_operand:HI 1 "general_operand" "0")
  2117.          (match_operand:HI 2 "general_operand" "dmn")))]
  2118.   ""
  2119.   "*
  2120. {
  2121.   /* The swap insn produces cc's that don't correspond to the result.  */
  2122.   CC_STATUS_INIT;
  2123.   return \"and.l #$FFFF,%0\;divu.w %2,%0\;swap %0\";
  2124. }")
  2125.  
  2126. (define_insn "umodhisi3"
  2127.   [(set (match_operand:HI 0 "general_operand" "=d")
  2128.     (umod:HI (match_operand:SI 1 "general_operand" "0")
  2129.          (match_operand:HI 2 "general_operand" "dmn")))]
  2130.   ""
  2131.   "*
  2132. {
  2133.   /* The swap insn produces cc's that don't correspond to the result.  */
  2134.   CC_STATUS_INIT;
  2135.   return \"divu.w %2,%0\;swap %0\";
  2136. }")
  2137.  
  2138. (define_insn "divmodsi4"
  2139.   [(set (match_operand:SI 0 "general_operand" "=d")
  2140.     (div:SI (match_operand:SI 1 "general_operand" "0")
  2141.         (match_operand:SI 2 "general_operand" "dmsK")))
  2142.    (set (match_operand:SI 3 "general_operand" "=d")
  2143.     (mod:SI (match_dup 1) (match_dup 2)))]
  2144.   "TARGET_68020"
  2145.   "tdivs.l %2,%3:%0")
  2146.  
  2147. (define_insn "udivmodsi4"
  2148.   [(set (match_operand:SI 0 "general_operand" "=d")
  2149.     (udiv:SI (match_operand:SI 1 "general_operand" "0")
  2150.          (match_operand:SI 2 "general_operand" "dmsK")))
  2151.    (set (match_operand:SI 3 "general_operand" "=d")
  2152.     (umod:SI (match_dup 1) (match_dup 2)))]
  2153.   "TARGET_68020"
  2154.   "tdivu.l %2,%3:%0")
  2155.  
  2156. ;; logical-and instructions
  2157.  
  2158. (define_insn "andsi3"
  2159.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  2160.     (and:SI (match_operand:SI 1 "general_operand" "%0,0")
  2161.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  2162.   ""
  2163.   "*
  2164. {
  2165.   if (GET_CODE (operands[2]) == CONST_INT
  2166.       && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
  2167.       && (DATA_REG_P (operands[0])
  2168.       || offsettable_memref_p (operands[0])))
  2169.     { 
  2170.       if (GET_CODE (operands[0]) != REG)
  2171.         operands[0] = adj_offsettable_operand (operands[0], 2);
  2172.       operands[2] = gen_rtx (CONST_INT, VOIDmode,
  2173.                  INTVAL (operands[2]) & 0xffff);
  2174.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2175.       CC_STATUS_INIT;
  2176.       if (operands[2] == const0_rtx)
  2177.         return \"clr.w %0\";
  2178.       return \"and.w %2,%0\";
  2179.     }
  2180.   return \"and.l %2,%0\";
  2181. }")
  2182.  
  2183. (define_insn "andhi3"
  2184.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  2185.     (and:HI (match_operand:HI 1 "general_operand" "%0,0")
  2186.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  2187.   ""
  2188.   "and.w %2,%0")
  2189.  
  2190. (define_insn "andqi3"
  2191.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2192.     (and:QI (match_operand:QI 1 "general_operand" "%0,0")
  2193.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2194.   ""
  2195.   "and.b %2,%0")
  2196.  
  2197. (define_insn ""
  2198.   [(set (match_operand:SI 0 "general_operand" "=d")
  2199.     (and:SI (zero_extend:SI (match_operand:HI 1 "general_operand" "dm"))
  2200.         (match_operand:SI 2 "general_operand" "0")))]
  2201.   "GET_CODE (operands[2]) == CONST_INT
  2202.    && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (HImode))"
  2203.   "and.w %1,%0")
  2204.  
  2205. (define_insn ""
  2206.   [(set (match_operand:SI 0 "general_operand" "=d")
  2207.     (and:SI (zero_extend:SI (match_operand:QI 1 "general_operand" "dm"))
  2208.         (match_operand:SI 2 "general_operand" "0")))]
  2209.   "GET_CODE (operands[2]) == CONST_INT
  2210.    && (unsigned int) INTVAL (operands[2]) < (1 << GET_MODE_BITSIZE (QImode))"
  2211.   "and.b %1,%0")
  2212.  
  2213. ;; inclusive-or instructions
  2214.  
  2215. (define_insn "iorsi3"
  2216.   [(set (match_operand:SI 0 "general_operand" "=m,d")
  2217.     (ior:SI (match_operand:SI 1 "general_operand" "%0,0")
  2218.         (match_operand:SI 2 "general_operand" "dKs,dmKs")))]
  2219.   ""
  2220.   "*
  2221. {
  2222.   register int logval;
  2223.   if (GET_CODE (operands[2]) == CONST_INT
  2224.       && INTVAL (operands[2]) >> 16 == 0
  2225.       && (DATA_REG_P (operands[0])
  2226.       || offsettable_memref_p (operands[0])))
  2227.     { 
  2228.       if (GET_CODE (operands[0]) != REG)
  2229.         operands[0] = adj_offsettable_operand (operands[0], 2);
  2230.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2231.       CC_STATUS_INIT;
  2232.       return \"or.w %2,%0\";
  2233.     }
  2234.   if (GET_CODE (operands[2]) == CONST_INT
  2235.       && (logval = exact_log2 (INTVAL (operands[2]))) >= 0
  2236.       && (DATA_REG_P (operands[0])
  2237.       || offsettable_memref_p (operands[0])))
  2238.     { 
  2239.       if (DATA_REG_P (operands[0]))
  2240.     {
  2241.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval);
  2242.     }
  2243.       else
  2244.         {
  2245.       operands[0] = adj_offsettable_operand (operands[0], 3 - (logval / 8));
  2246.       operands[1] = gen_rtx (CONST_INT, VOIDmode, logval % 8);
  2247.     }
  2248.       return \"bset %1,%0\";
  2249.     }
  2250.   return \"or.l %2,%0\";
  2251. }")
  2252.  
  2253. (define_insn "iorhi3"
  2254.   [(set (match_operand:HI 0 "general_operand" "=m,d")
  2255.     (ior:HI (match_operand:HI 1 "general_operand" "%0,0")
  2256.         (match_operand:HI 2 "general_operand" "dn,dmn")))]
  2257.   ""
  2258.   "or.w %2,%0")
  2259.  
  2260. (define_insn "iorqi3"
  2261.   [(set (match_operand:QI 0 "general_operand" "=m,d")
  2262.     (ior:QI (match_operand:QI 1 "general_operand" "%0,0")
  2263.         (match_operand:QI 2 "general_operand" "dn,dmn")))]
  2264.   ""
  2265.   "or.b %2,%0")
  2266.  
  2267. ;; xor instructions
  2268.  
  2269. (define_insn "xorsi3"
  2270.   [(set (match_operand:SI 0 "general_operand" "=do,m")
  2271.     (xor:SI (match_operand:SI 1 "general_operand" "%0,0")
  2272.         (match_operand:SI 2 "general_operand" "di,dKs")))]
  2273.   ""
  2274.   "*
  2275. {
  2276.   if (GET_CODE (operands[2]) == CONST_INT
  2277.       && INTVAL (operands[2]) >> 16 == 0
  2278.       && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0])))
  2279.     { 
  2280.       if (! DATA_REG_P (operands[0]))
  2281.     operands[0] = adj_offsettable_operand (operands[0], 2);
  2282.       /* Do not delete a following tstl %0 insn; that would be incorrect.  */
  2283.       CC_STATUS_INIT;
  2284.       return \"eor.w %2,%0\";
  2285.     }
  2286.   return \"eor.l %2,%0\";
  2287. }")
  2288.  
  2289. (define_insn "xorhi3"
  2290.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2291.     (xor:HI (match_operand:HI 1 "general_operand" "%0")
  2292.         (match_operand:HI 2 "general_operand" "dn")))]
  2293.   ""
  2294.   "eor.w %2,%0")
  2295.  
  2296. (define_insn "xorqi3"
  2297.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2298.     (xor:QI (match_operand:QI 1 "general_operand" "%0")
  2299.         (match_operand:QI 2 "general_operand" "dn")))]
  2300.   ""
  2301.   "eor.b %2,%0")
  2302.  
  2303. ;; negation instructions
  2304.  
  2305. (define_insn "negsi2"
  2306.   [(set (match_operand:SI 0 "general_operand" "=dm")
  2307.     (neg:SI (match_operand:SI 1 "general_operand" "0")))]
  2308.   ""
  2309.   "neg.l %0")
  2310.  
  2311. (define_insn "neghi2"
  2312.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2313.     (neg:HI (match_operand:HI 1 "general_operand" "0")))]
  2314.   ""
  2315.   "neg.w %0")
  2316.  
  2317. (define_insn "negqi2"
  2318.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2319.     (neg:QI (match_operand:QI 1 "general_operand" "0")))]
  2320.   ""
  2321.   "neg.b %0")
  2322.  
  2323. (define_expand "negsf2"
  2324.   [(set (match_operand:SF 0 "general_operand" "")
  2325.     (neg:SF (match_operand:SF 1 "general_operand" "")))]
  2326.   "TARGET_SANE || TARGET_68881"
  2327.   "")
  2328.  
  2329. (define_insn ""
  2330.   [(set (match_operand:SF 0 "general_operand" "=f")
  2331.     (neg:SF (match_operand:SF 1 "general_operand" "fmF")))]
  2332.   "TARGET_68881"
  2333.   "*
  2334. {
  2335.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2336.     return \"fneg.x %1,%0\";
  2337.   return \"fneg.s %1,%0\";
  2338. }")
  2339.  
  2340. (define_insn ""
  2341.   [(set (match_operand:SF 0 "general_operand" "=ro")
  2342.     (neg:SF (match_operand:SF 1 "general_operand" "0")))]
  2343.   "TARGET_SANE"
  2344.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  2345.  
  2346. (define_expand "negdf2"
  2347.   [(set (match_operand:DF 0 "general_operand" "")
  2348.     (neg:DF (match_operand:DF 1 "general_operand" "")))]
  2349.   "TARGET_SANE || TARGET_68881"
  2350.   "")
  2351.  
  2352. (define_insn ""
  2353.   [(set (match_operand:DF 0 "general_operand" "=f")
  2354.     (neg:DF (match_operand:DF 1 "general_operand" "fmG")))]
  2355.   "TARGET_68881"
  2356.   "*
  2357. {
  2358.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2359.     return \"fneg.x %1,%0\";
  2360.   return \"fneg.d %1,%0\";
  2361. }")
  2362.  
  2363. (define_insn ""
  2364.   [(set (match_operand:DF 0 "general_operand" "=ro")
  2365.     (neg:DF (match_operand:DF 1 "general_operand" "0")))]
  2366.   "TARGET_SANE"
  2367.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  2368.  
  2369. (define_expand "negxf2"
  2370.   [(set (match_operand:XF 0 "general_operand" "")
  2371.     (neg:XF (match_operand:XF 1 "general_operand" "")))]
  2372.   "TARGET_SANE || TARGET_68881"
  2373.   "")
  2374.  
  2375. (define_insn ""
  2376.   [(set (match_operand:XF 0 "general_operand" "=f")
  2377.     (neg:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2378.   "TARGET_68881"
  2379.   "fneg.x %1,%0")
  2380.  
  2381. (define_insn ""
  2382.   [(set (match_operand:XF 0 "general_operand" "=ro")
  2383.     (neg:XF (match_operand:XF 1 "general_operand" "0")))]
  2384.   "TARGET_SANE"
  2385.   "* return output_sane_2 (operands, 0x000d, \"FNEGX\");")
  2386.  
  2387. ;; Assorted math function handling
  2388.  
  2389. (define_insn "sinxf2"
  2390.   [(set (match_operand:XF 0 "general_operand" "=f")
  2391.     (sin:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2392.   "TARGET_ELEMS881"
  2393.   "fsin.x %1,%0")
  2394.  
  2395. (define_insn "cosxf2"
  2396.   [(set (match_operand:XF 0 "general_operand" "=f")
  2397.     (cos:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2398.   "TARGET_ELEMS881"
  2399.   "fcos.x %1,%0")
  2400.  
  2401. (define_insn "tanxf2"
  2402.   [(set (match_operand:XF 0 "general_operand" "=f")
  2403.     (tan:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2404.   "TARGET_ELEMS881"
  2405.   "ftan.x %1,%0")
  2406.  
  2407. (define_insn "asinxf2"
  2408.   [(set (match_operand:XF 0 "general_operand" "=f")
  2409.     (asin:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2410.   "TARGET_ELEMS881"
  2411.   "fasin.x %1,%0")
  2412.  
  2413. (define_insn "acosxf2"
  2414.   [(set (match_operand:XF 0 "general_operand" "=f")
  2415.     (acos:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2416.   "TARGET_ELEMS881"
  2417.   "facos.x %1,%0")
  2418.  
  2419. (define_insn "atanxf2"
  2420.   [(set (match_operand:XF 0 "general_operand" "=f")
  2421.     (atan:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2422.   "TARGET_ELEMS881"
  2423.   "fatan.x %1,%0")
  2424.  
  2425. (define_insn "sinhxf2"
  2426.   [(set (match_operand:XF 0 "general_operand" "=f")
  2427.     (sinh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2428.   "TARGET_ELEMS881"
  2429.   "fsinh.x %1,%0")
  2430.  
  2431. (define_insn "coshxf2"
  2432.   [(set (match_operand:XF 0 "general_operand" "=f")
  2433.     (cosh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2434.   "TARGET_ELEMS881"
  2435.   "fcosh.x %1,%0")
  2436.  
  2437. (define_insn "tanhxf2"
  2438.   [(set (match_operand:XF 0 "general_operand" "=f")
  2439.     (tanh:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2440.   "TARGET_ELEMS881"
  2441.   "ftanh.x %1,%0")
  2442.  
  2443. (define_insn "expxf2"
  2444.   [(set (match_operand:XF 0 "general_operand" "=f")
  2445.     (exp:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2446.   "TARGET_ELEMS881"
  2447.   "fetox.x %1,%0")
  2448.  
  2449. (define_insn "logxf2"
  2450.   [(set (match_operand:XF 0 "general_operand" "=f")
  2451.     (log:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2452.   "TARGET_ELEMS881"
  2453.   "flogn.x %1,%0")
  2454.  
  2455. (define_insn "log10xf2"
  2456.   [(set (match_operand:XF 0 "general_operand" "=f")
  2457.     (log10:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2458.   "TARGET_ELEMS881"
  2459.   "flog10.x %1,%0")
  2460.  
  2461. (define_insn "sqrtxf2"
  2462.   [(set (match_operand:XF 0 "general_operand" "=f")
  2463.     (sqrt:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2464.   "TARGET_ELEMS881"
  2465.   "fsqrt.x %1,%0")
  2466.  
  2467. ;; Don't bother trying to make SANE math calls directly, -elems881
  2468. ;; implies -mc68881 anyway.
  2469.  
  2470. ;; Absolute value instructions
  2471.  
  2472. (define_expand "abssf2"
  2473.   [(set (match_operand:SF 0 "general_operand" "")
  2474.     (abs:SF (match_operand:SF 1 "general_operand" "")))]
  2475.   "TARGET_SANE || TARGET_68881"
  2476.   "")
  2477.  
  2478. (define_insn ""
  2479.   [(set (match_operand:SF 0 "general_operand" "=f")
  2480.     (abs:SF (match_operand:SF 1 "general_operand" "fmF")))]
  2481.   "TARGET_68881"
  2482.   "*
  2483. {
  2484.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2485.     return \"fabs.x %1,%0\";
  2486.   return \"fabs.s %1,%0\";
  2487. }")
  2488.  
  2489. (define_insn ""
  2490.   [(set (match_operand:SF 0 "general_operand" "=ro")
  2491.     (abs:SF (match_operand:SF 1 "general_operand" "0")))]
  2492.   "TARGET_SANE"
  2493.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  2494.  
  2495. (define_expand "absdf2"
  2496.   [(set (match_operand:DF 0 "general_operand" "")
  2497.     (abs:DF (match_operand:DF 1 "general_operand" "")))]
  2498.   "TARGET_SANE || TARGET_68881"
  2499.   "")
  2500.  
  2501. (define_insn ""
  2502.   [(set (match_operand:DF 0 "general_operand" "=f")
  2503.     (abs:DF (match_operand:DF 1 "general_operand" "fmG")))]
  2504.   "TARGET_68881"
  2505.   "*
  2506. {
  2507.   if (REG_P (operands[1]) && ! DATA_REG_P (operands[1]))
  2508.     return \"fabs.x %1,%0\";
  2509.   return \"fabs.d %1,%0\";
  2510. }")
  2511.  
  2512. (define_insn ""
  2513.   [(set (match_operand:DF 0 "general_operand" "=ro")
  2514.     (abs:DF (match_operand:DF 1 "general_operand" "0")))]
  2515.   "TARGET_SANE"
  2516.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  2517.  
  2518. (define_expand "absxf2"
  2519.   [(set (match_operand:XF 0 "general_operand" "")
  2520.     (abs:XF (match_operand:XF 1 "general_operand" "")))]
  2521.   "TARGET_SANE || TARGET_68881"
  2522.   "")
  2523.  
  2524. (define_insn ""
  2525.   [(set (match_operand:XF 0 "general_operand" "=f")
  2526.     (abs:XF (match_operand:XF 1 "general_operand" "fmG")))]
  2527.   "TARGET_68881"
  2528.   "fabs.x %1,%0")
  2529.  
  2530. (define_insn ""
  2531.   [(set (match_operand:XF 0 "general_operand" "=ro")
  2532.     (abs:XF (match_operand:XF 1 "general_operand" "0")))]
  2533.   "TARGET_SANE"
  2534.   "* return output_sane_2 (operands, 0x000f, \"FABSX\");")
  2535.  
  2536. ;; one complement instructions
  2537.  
  2538. (define_insn "one_cmplsi2"
  2539.   [(set (match_operand:SI 0 "general_operand" "=dm")
  2540.     (not:SI (match_operand:SI 1 "general_operand" "0")))]
  2541.   ""
  2542.   "not.l %0")
  2543.  
  2544. (define_insn "one_cmplhi2"
  2545.   [(set (match_operand:HI 0 "general_operand" "=dm")
  2546.     (not:HI (match_operand:HI 1 "general_operand" "0")))]
  2547.   ""
  2548.   "not.w %0")
  2549.  
  2550. (define_insn "one_cmplqi2"
  2551.   [(set (match_operand:QI 0 "general_operand" "=dm")
  2552.     (not:QI (match_operand:QI 1 "general_operand" "0")))]
  2553.   ""
  2554.   "not.b %0")
  2555.  
  2556. ;; Optimized special case of shifting.
  2557. ;; Must precede the general case.
  2558.  
  2559. (define_insn ""
  2560.   [(set (match_operand:SI 0 "general_operand" "=d")
  2561.     (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2562.              (const_int 24)))]
  2563.   "GET_CODE (XEXP (operands[1], 0)) != POST_INC
  2564.    && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
  2565.   "*
  2566. {
  2567.   if (TARGET_68020)
  2568.     return \"move.b %1,%0\;extb.l %0\";
  2569.   return \"move.b %1,%0\;ext.w %0\;ext.l %0\";
  2570. }")
  2571.  
  2572. (define_insn ""
  2573.   [(set (match_operand:SI 0 "general_operand" "=d")
  2574.     (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2575.              (const_int 24)))]
  2576.   "GET_CODE (XEXP (operands[1], 0)) != POST_INC
  2577.    && GET_CODE (XEXP (operands[1], 0)) != PRE_DEC"
  2578.   "*
  2579. {
  2580.   if (reg_mentioned_p (operands[0], operands[1]))
  2581.     return \"move.b %1,%0\;and.l #$FF,%0\";
  2582.   return \"clr.l %0\;move.b %1,%0\";
  2583. }")
  2584.  
  2585. (define_insn ""
  2586.   [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
  2587.                (lshiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2588.                     (const_int 24))))]
  2589.   "(GET_CODE (operands[0]) == CONST_INT
  2590.     && (INTVAL (operands[0]) & ~0xff) == 0)"
  2591.   "* cc_status.flags |= CC_REVERSED;
  2592.   return \"cmp.b %0,%1\";
  2593. ")
  2594.  
  2595. (define_insn ""
  2596.   [(set (cc0) (compare (lshiftrt:SI (match_operand:SI 0 "memory_operand" "m")
  2597.                     (const_int 24))
  2598.                (match_operand:QI 1 "general_operand" "i")))]
  2599.   "(GET_CODE (operands[1]) == CONST_INT
  2600.     && (INTVAL (operands[1]) & ~0xff) == 0)"
  2601.   "*
  2602.   return \"cmp.b %1,%0\";
  2603. ")
  2604.  
  2605. (define_insn ""
  2606.   [(set (cc0) (compare (match_operand:QI 0 "general_operand" "i")
  2607.                (ashiftrt:SI (match_operand:SI 1 "memory_operand" "m")
  2608.                     (const_int 24))))]
  2609.   "(GET_CODE (operands[0]) == CONST_INT
  2610.     && ((INTVAL (operands[0]) + 0x80) & ~0xff) == 0)"
  2611.   "* cc_status.flags |= CC_REVERSED;
  2612.   return \"cmp.b %0,%1\";
  2613. ")
  2614.  
  2615. (define_insn ""
  2616.   [(set (cc0) (compare (ashiftrt:SI (match_operand:SI 0 "memory_operand" "m")
  2617.                     (const_int 24))
  2618.                (match_operand:QI 1 "general_operand" "i")))]
  2619.   "(GET_CODE (operands[1]) == CONST_INT
  2620.     && ((INTVAL (operands[1]) + 0x80) & ~0xff) == 0)"
  2621.   "*
  2622.   return \"cmp.b %1,%0\";
  2623. ")
  2624.  
  2625. ;; arithmetic shift instructions
  2626. ;; We don't need the shift memory by 1 bit instruction
  2627.  
  2628. (define_insn "ashlsi3"
  2629.   [(set (match_operand:SI 0 "general_operand" "=d")
  2630.     (ashift:SI (match_operand:SI 1 "general_operand" "0")
  2631.            (match_operand:SI 2 "general_operand" "dI")))]
  2632.   ""
  2633.   "asl.l %2,%0")
  2634.  
  2635. (define_insn "ashlhi3"
  2636.   [(set (match_operand:HI 0 "general_operand" "=d")
  2637.     (ashift:HI (match_operand:HI 1 "general_operand" "0")
  2638.            (match_operand:HI 2 "general_operand" "dI")))]
  2639.   ""
  2640.   "asl.w %2,%0")
  2641.  
  2642. (define_insn "ashlqi3"
  2643.   [(set (match_operand:QI 0 "general_operand" "=d")
  2644.     (ashift:QI (match_operand:QI 1 "general_operand" "0")
  2645.            (match_operand:QI 2 "general_operand" "dI")))]
  2646.   ""
  2647.   "asl.b %2,%0")
  2648.  
  2649. (define_insn "ashrsi3"
  2650.   [(set (match_operand:SI 0 "general_operand" "=d")
  2651.     (ashiftrt:SI (match_operand:SI 1 "general_operand" "0")
  2652.              (match_operand:SI 2 "general_operand" "dI")))]
  2653.   ""
  2654.   "asr.l %2,%0")
  2655.  
  2656. (define_insn "ashrhi3"
  2657.   [(set (match_operand:HI 0 "general_operand" "=d")
  2658.     (ashiftrt:HI (match_operand:HI 1 "general_operand" "0")
  2659.              (match_operand:HI 2 "general_operand" "dI")))]
  2660.   ""
  2661.   "asr.w %2,%0")
  2662.  
  2663. (define_insn "ashrqi3"
  2664.   [(set (match_operand:QI 0 "general_operand" "=d")
  2665.     (ashiftrt:QI (match_operand:QI 1 "general_operand" "0")
  2666.              (match_operand:QI 2 "general_operand" "dI")))]
  2667.   ""
  2668.   "asr.b %2,%0")
  2669.  
  2670. ;; logical shift instructions
  2671.  
  2672. (define_insn "lshlsi3"
  2673.   [(set (match_operand:SI 0 "general_operand" "=d")
  2674.     (lshift:SI (match_operand:SI 1 "general_operand" "0")
  2675.            (match_operand:SI 2 "general_operand" "dI")))]
  2676.   ""
  2677.   "lsl.l %2,%0")
  2678.  
  2679. (define_insn "lshlhi3"
  2680.   [(set (match_operand:HI 0 "general_operand" "=d")
  2681.     (lshift:HI (match_operand:HI 1 "general_operand" "0")
  2682.            (match_operand:HI 2 "general_operand" "dI")))]
  2683.   ""
  2684.   "lsl.w %2,%0")
  2685.  
  2686. (define_insn "lshlqi3"
  2687.   [(set (match_operand:QI 0 "general_operand" "=d")
  2688.     (lshift:QI (match_operand:QI 1 "general_operand" "0")
  2689.            (match_operand:QI 2 "general_operand" "dI")))]
  2690.   ""
  2691.   "lsl.b %2,%0")
  2692.  
  2693. (define_insn "lshrsi3"
  2694.   [(set (match_operand:SI 0 "general_operand" "=d")
  2695.     (lshiftrt:SI (match_operand:SI 1 "general_operand" "0")
  2696.              (match_operand:SI 2 "general_operand" "dI")))]
  2697.   ""
  2698.   "lsr.l %2,%0")
  2699.  
  2700. (define_insn "lshrhi3"
  2701.   [(set (match_operand:HI 0 "general_operand" "=d")
  2702.     (lshiftrt:HI (match_operand:HI 1 "general_operand" "0")
  2703.              (match_operand:HI 2 "general_operand" "dI")))]
  2704.   ""
  2705.   "lsr.w %2,%0")
  2706.  
  2707. (define_insn "lshrqi3"
  2708.   [(set (match_operand:QI 0 "general_operand" "=d")
  2709.     (lshiftrt:QI (match_operand:QI 1 "general_operand" "0")
  2710.              (match_operand:QI 2 "general_operand" "dI")))]
  2711.   ""
  2712.   "lsr.b %2,%0")
  2713.  
  2714. ;; rotate instructions
  2715.  
  2716. (define_insn "rotlsi3"
  2717.   [(set (match_operand:SI 0 "general_operand" "=d")
  2718.     (rotate:SI (match_operand:SI 1 "general_operand" "0")
  2719.            (match_operand:SI 2 "general_operand" "dI")))]
  2720.   ""
  2721.   "rol.l %2,%0")
  2722.  
  2723. (define_insn "rotlhi3"
  2724.   [(set (match_operand:HI 0 "general_operand" "=d")
  2725.     (rotate:HI (match_operand:HI 1 "general_operand" "0")
  2726.            (match_operand:HI 2 "general_operand" "dI")))]
  2727.   ""
  2728.   "rol.w %2,%0")
  2729.  
  2730. (define_insn "rotlqi3"
  2731.   [(set (match_operand:QI 0 "general_operand" "=d")
  2732.     (rotate:QI (match_operand:QI 1 "general_operand" "0")
  2733.            (match_operand:QI 2 "general_operand" "dI")))]
  2734.   ""
  2735.   "rol.b %2,%0")
  2736.  
  2737. (define_insn "rotrsi3"
  2738.   [(set (match_operand:SI 0 "general_operand" "=d")
  2739.     (rotatert:SI (match_operand:SI 1 "general_operand" "0")
  2740.              (match_operand:SI 2 "general_operand" "dI")))]
  2741.   ""
  2742.   "ror.l %2,%0")
  2743.  
  2744. (define_insn "rotrhi3"
  2745.   [(set (match_operand:HI 0 "general_operand" "=d")
  2746.     (rotatert:HI (match_operand:HI 1 "general_operand" "0")
  2747.              (match_operand:HI 2 "general_operand" "dI")))]
  2748.   ""
  2749.   "ror.w %2,%0")
  2750.  
  2751. (define_insn "rotrqi3"
  2752.   [(set (match_operand:QI 0 "general_operand" "=d")
  2753.     (rotatert:QI (match_operand:QI 1 "general_operand" "0")
  2754.              (match_operand:QI 2 "general_operand" "dI")))]
  2755.   ""
  2756.   "ror.b %2,%0")
  2757.  
  2758. ;; Special cases of bit-field insns which we should
  2759. ;; recognize in preference to the general case.
  2760. ;; These handle aligned 8-bit and 16-bit fields,
  2761. ;; which can usually be done with move instructions.
  2762.  
  2763. (define_insn ""
  2764.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+do")
  2765.              (match_operand:SI 1 "immediate_operand" "i")
  2766.              (match_operand:SI 2 "immediate_operand" "i"))
  2767.     (match_operand:SI 3 "general_operand" "d"))]
  2768.   "TARGET_68020 && TARGET_BITFIELD
  2769.    && GET_CODE (operands[1]) == CONST_INT
  2770.    && (INTVAL (operands[1]) == 8 || INTVAL (operands[1]) == 16)
  2771.    && GET_CODE (operands[2]) == CONST_INT
  2772.    && INTVAL (operands[2]) % INTVAL (operands[1]) == 0
  2773.    && (GET_CODE (operands[0]) == REG
  2774.        || ! mode_dependent_address_p (XEXP (operands[0], 0)))"
  2775.   "*
  2776. {
  2777.   if (REG_P (operands[0]))
  2778.     {
  2779.       if (INTVAL (operands[1]) + INTVAL (operands[2]) != 32)
  2780.         return \"bfins %3,%0{%b2:%b1}\";
  2781.     }
  2782.   else
  2783.     operands[0]
  2784.       = adj_offsettable_operand (operands[0], INTVAL (operands[2]) / 8);
  2785.  
  2786.   if (GET_CODE (operands[3]) == MEM)
  2787.     operands[3] = adj_offsettable_operand (operands[3],
  2788.                       (32 - INTVAL (operands[1])) / 8);
  2789.   if (INTVAL (operands[1]) == 8)
  2790.     return \"move.b %3,%0\";
  2791.   return \"move.w %3,%0\";
  2792. }")
  2793.  
  2794. (define_insn ""
  2795.   [(set (match_operand:SI 0 "general_operand" "=&d")
  2796.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  2797.              (match_operand:SI 2 "immediate_operand" "i")
  2798.              (match_operand:SI 3 "immediate_operand" "i")))]
  2799.   "TARGET_68020 && TARGET_BITFIELD
  2800.    && GET_CODE (operands[2]) == CONST_INT
  2801.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  2802.    && GET_CODE (operands[3]) == CONST_INT
  2803.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  2804.    && (GET_CODE (operands[1]) == REG
  2805.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  2806.   "*
  2807. {
  2808.   if (REG_P (operands[1]))
  2809.     {
  2810.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  2811.     return \"bfextu %1{%b3:%b2},%0\";
  2812.     }
  2813.   else
  2814.     operands[1]
  2815.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  2816.  
  2817.   output_asm_insn (\"clr.l %0\", operands);
  2818.   if (GET_CODE (operands[0]) == MEM)
  2819.     operands[0] = adj_offsettable_operand (operands[0],
  2820.                       (32 - INTVAL (operands[1])) / 8);
  2821.   if (INTVAL (operands[2]) == 8)
  2822.     return \"move.b %1,%0\";
  2823.   return \"move.w %1,%0\";
  2824. }")
  2825.  
  2826. (define_insn ""
  2827.   [(set (match_operand:SI 0 "general_operand" "=d")
  2828.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "do")
  2829.              (match_operand:SI 2 "immediate_operand" "i")
  2830.              (match_operand:SI 3 "immediate_operand" "i")))]
  2831.   "TARGET_68020 && TARGET_BITFIELD
  2832.    && GET_CODE (operands[2]) == CONST_INT
  2833.    && (INTVAL (operands[2]) == 8 || INTVAL (operands[2]) == 16)
  2834.    && GET_CODE (operands[3]) == CONST_INT
  2835.    && INTVAL (operands[3]) % INTVAL (operands[2]) == 0
  2836.    && (GET_CODE (operands[1]) == REG
  2837.        || ! mode_dependent_address_p (XEXP (operands[1], 0)))"
  2838.   "*
  2839. {
  2840.   if (REG_P (operands[1]))
  2841.     {
  2842.       if (INTVAL (operands[2]) + INTVAL (operands[3]) != 32)
  2843.     return \"bfexts %1{%b3:%b2},%0\";
  2844.     }
  2845.   else
  2846.     operands[1]
  2847.       = adj_offsettable_operand (operands[1], INTVAL (operands[3]) / 8);
  2848.  
  2849.   if (INTVAL (operands[2]) == 8)
  2850.     return \"move.b %1,%0\;extb.l %0\";
  2851.   return \"move.w %1,%0\;ext.l %0\";
  2852. }")
  2853.  
  2854. ;; Bit field instructions, general cases.
  2855. ;; "o,d" constraint causes a nonoffsettable memref to match the "o"
  2856. ;; so that its address is reloaded.
  2857.  
  2858. (define_insn "extv"
  2859.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2860.     (sign_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  2861.              (match_operand:SI 2 "general_operand" "di,di")
  2862.              (match_operand:SI 3 "general_operand" "di,di")))]
  2863.   "TARGET_68020 && TARGET_BITFIELD"
  2864.   "bfexts %1{%b3:%b2},%0")
  2865.  
  2866. (define_insn "extzv"
  2867.   [(set (match_operand:SI 0 "general_operand" "=d,d")
  2868.     (zero_extract:SI (match_operand:QI 1 "nonimmediate_operand" "o,d")
  2869.              (match_operand:SI 2 "general_operand" "di,di")
  2870.              (match_operand:SI 3 "general_operand" "di,di")))]
  2871.   "TARGET_68020 && TARGET_BITFIELD"
  2872.   "bfextu %1{%b3:%b2},%0")
  2873.  
  2874. (define_insn ""
  2875.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2876.              (match_operand:SI 1 "general_operand" "di,di")
  2877.              (match_operand:SI 2 "general_operand" "di,di"))
  2878.         (xor:SI (zero_extract:SI (match_dup 0) (match_dup 1) (match_dup 2))
  2879.         (match_operand 3 "immediate_operand" "i,i")))]
  2880.   "TARGET_68020 && TARGET_BITFIELD
  2881.    && GET_CODE (operands[3]) == CONST_INT
  2882.    && (INTVAL (operands[3]) == -1
  2883.        || (GET_CODE (operands[1]) == CONST_INT
  2884.            && (~ INTVAL (operands[3]) & ((1 << INTVAL (operands[1]))- 1)) == 0))"
  2885.   "*
  2886. {
  2887.   CC_STATUS_INIT;
  2888.   return \"bfchg %0{%b2:%b1}\";
  2889. }")
  2890.  
  2891. (define_insn ""
  2892.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2893.              (match_operand:SI 1 "general_operand" "di,di")
  2894.              (match_operand:SI 2 "general_operand" "di,di"))
  2895.     (const_int 0))]
  2896.   "TARGET_68020 && TARGET_BITFIELD"
  2897.   "*
  2898. {
  2899.   CC_STATUS_INIT;
  2900.   return \"bfclr %0{%b2:%b1}\";
  2901. }")
  2902.  
  2903. (define_insn ""
  2904.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2905.              (match_operand:SI 1 "general_operand" "di,di")
  2906.              (match_operand:SI 2 "general_operand" "di,di"))
  2907.     (const_int -1))]
  2908.   "TARGET_68020 && TARGET_BITFIELD"
  2909.   "*
  2910. {
  2911.   CC_STATUS_INIT;
  2912.   return \"bfset %0{%b2:%b1}\";
  2913. }")
  2914.  
  2915. (define_insn "insv"
  2916.   [(set (zero_extract:SI (match_operand:QI 0 "nonimmediate_operand" "+o,d")
  2917.              (match_operand:SI 1 "general_operand" "di,di")
  2918.              (match_operand:SI 2 "general_operand" "di,di"))
  2919.     (match_operand:SI 3 "general_operand" "d,d"))]
  2920.   "TARGET_68020 && TARGET_BITFIELD"
  2921.   "bfins %3,%0{%b2:%b1}")
  2922.  
  2923. ;; Now recognize bit field insns that operate on registers
  2924. ;; (or at least were intended to do so).
  2925.  
  2926. (define_insn ""
  2927.   [(set (match_operand:SI 0 "general_operand" "=d")
  2928.     (sign_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  2929.              (match_operand:SI 2 "general_operand" "di")
  2930.              (match_operand:SI 3 "general_operand" "di")))]
  2931.   "TARGET_68020 && TARGET_BITFIELD"
  2932.   "bfexts %1{%b3:%b2},%0")
  2933.  
  2934. (define_insn ""
  2935.   [(set (match_operand:SI 0 "general_operand" "=d")
  2936.     (zero_extract:SI (match_operand:SI 1 "nonimmediate_operand" "d")
  2937.              (match_operand:SI 2 "general_operand" "di")
  2938.              (match_operand:SI 3 "general_operand" "di")))]
  2939.   "TARGET_68020 && TARGET_BITFIELD"
  2940.   "bfextu %1{%b3:%b2},%0")
  2941.  
  2942. (define_insn ""
  2943.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  2944.              (match_operand:SI 1 "general_operand" "di")
  2945.              (match_operand:SI 2 "general_operand" "di"))
  2946.     (const_int 0))]
  2947.   "TARGET_68020 && TARGET_BITFIELD"
  2948.   "*
  2949. {
  2950.   CC_STATUS_INIT;
  2951.   return \"bfclr %0{%b2:%b1}\";
  2952. }")
  2953.  
  2954. (define_insn ""
  2955.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  2956.              (match_operand:SI 1 "general_operand" "di")
  2957.              (match_operand:SI 2 "general_operand" "di"))
  2958.     (const_int -1))]
  2959.   "TARGET_68020 && TARGET_BITFIELD"
  2960.   "*
  2961. {
  2962.   CC_STATUS_INIT;
  2963.   return \"bfset %0{%b2:%b1}\";
  2964. }")
  2965.  
  2966. (define_insn ""
  2967.   [(set (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "+d")
  2968.              (match_operand:SI 1 "general_operand" "di")
  2969.              (match_operand:SI 2 "general_operand" "di"))
  2970.     (match_operand:SI 3 "general_operand" "d"))]
  2971.   "TARGET_68020 && TARGET_BITFIELD"
  2972.   "*
  2973. {
  2974. #if 0
  2975.   /* These special cases are now recognized by a specific pattern.  */
  2976.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  2977.       && INTVAL (operands[1]) == 16 && INTVAL (operands[2]) == 16)
  2978.     return \"move.w %3,%0\";
  2979.   if (GET_CODE (operands[1]) == CONST_INT && GET_CODE (operands[2]) == CONST_INT
  2980.       && INTVAL (operands[1]) == 24 && INTVAL (operands[2]) == 8)
  2981.     return \"move.b %3,%0\";
  2982. #endif
  2983.   return \"bfins %3,%0{%b2:%b1}\";
  2984. }")
  2985.  
  2986. ;; Special patterns for optimizing bit-field instructions.
  2987.  
  2988. (define_insn ""
  2989.   [(set (cc0)
  2990.     (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  2991.              (match_operand:SI 1 "general_operand" "di")
  2992.              (match_operand:SI 2 "general_operand" "di")))]
  2993.   "TARGET_68020 && TARGET_BITFIELD
  2994.    && GET_CODE (operands[1]) == CONST_INT"
  2995.   "*
  2996. {
  2997.   if (operands[1] == const1_rtx
  2998.       && GET_CODE (operands[2]) == CONST_INT)
  2999.     {    
  3000.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3001.       return output_btst (operands,
  3002.               gen_rtx (CONST_INT, VOIDmode,
  3003.                    width - INTVAL (operands[2])),
  3004.               operands[0],
  3005.               insn, 1000);
  3006.       /* Pass 1000 as SIGNPOS argument so that btst will
  3007.          not think we are testing the sign bit for an `and'
  3008.      and assume that nonzero implies a negative result.  */
  3009.     }
  3010.   if (INTVAL (operands[1]) != 32)
  3011.     cc_status.flags = CC_NOT_NEGATIVE;
  3012.   return \"bftst %0{%b2:%b1}\";
  3013. }")
  3014.  
  3015. (define_insn ""
  3016.   [(set (cc0)
  3017.     (subreg:QI
  3018.      (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  3019.               (match_operand:SI 1 "general_operand" "di")
  3020.               (match_operand:SI 2 "general_operand" "di"))
  3021.      0))]
  3022.   "TARGET_68020 && TARGET_BITFIELD
  3023.    && GET_CODE (operands[1]) == CONST_INT"
  3024.   "*
  3025. {
  3026.   if (operands[1] == const1_rtx
  3027.       && GET_CODE (operands[2]) == CONST_INT)
  3028.     {    
  3029.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3030.       return output_btst (operands,
  3031.               gen_rtx (CONST_INT, VOIDmode,
  3032.                    width - INTVAL (operands[2])),
  3033.               operands[0],
  3034.               insn, 1000);
  3035.       /* Pass 1000 as SIGNPOS argument so that btst will
  3036.          not think we are testing the sign bit for an `and'
  3037.      and assume that nonzero implies a negative result.  */
  3038.     }
  3039.   if (INTVAL (operands[1]) != 32)
  3040.     cc_status.flags = CC_NOT_NEGATIVE;
  3041.   return \"bftst %0{%b2:%b1}\";
  3042. }")
  3043.  
  3044. (define_insn ""
  3045.   [(set (cc0)
  3046.     (subreg:HI
  3047.      (zero_extract:SI (match_operand:QI 0 "memory_operand" "o")
  3048.               (match_operand:SI 1 "general_operand" "di")
  3049.               (match_operand:SI 2 "general_operand" "di"))
  3050.      0))]
  3051.   "TARGET_68020 && TARGET_BITFIELD
  3052.    && GET_CODE (operands[1]) == CONST_INT"
  3053.   "*
  3054. {
  3055.   if (operands[1] == const1_rtx
  3056.       && GET_CODE (operands[2]) == CONST_INT)
  3057.     {    
  3058.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3059.       return output_btst (operands,
  3060.               gen_rtx (CONST_INT, VOIDmode,
  3061.                    width - INTVAL (operands[2])),
  3062.               operands[0],
  3063.               insn, 1000);
  3064.       /* Pass 1000 as SIGNPOS argument so that btst will
  3065.          not think we are testing the sign bit for an `and'
  3066.      and assume that nonzero implies a negative result.  */
  3067.     }
  3068.   if (INTVAL (operands[1]) != 32)
  3069.     cc_status.flags = CC_NOT_NEGATIVE;
  3070.   return \"bftst %0{%b2:%b1}\";
  3071. }")
  3072.   
  3073. ;;; now handle the register cases
  3074. (define_insn ""
  3075.   [(set (cc0)
  3076.     (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3077.              (match_operand:SI 1 "general_operand" "di")
  3078.              (match_operand:SI 2 "general_operand" "di")))]
  3079.   "TARGET_68020 && TARGET_BITFIELD
  3080.    && GET_CODE (operands[1]) == CONST_INT"
  3081.   "*
  3082. {
  3083.   if (operands[1] == const1_rtx
  3084.       && GET_CODE (operands[2]) == CONST_INT)
  3085.     {    
  3086.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3087.       return output_btst (operands,
  3088.               gen_rtx (CONST_INT, VOIDmode,
  3089.                    width - INTVAL (operands[2])),
  3090.               operands[0],
  3091.               insn, 1000);
  3092.       /* Pass 1000 as SIGNPOS argument so that btst will
  3093.          not think we are testing the sign bit for an `and'
  3094.      and assume that nonzero implies a negative result.  */
  3095.     }
  3096.   if (INTVAL (operands[1]) != 32)
  3097.     cc_status.flags = CC_NOT_NEGATIVE;
  3098.   return \"bftst %0{%b2:%b1}\";
  3099. }")
  3100.  
  3101. (define_insn ""
  3102.   [(set (cc0)
  3103.     (subreg:QI
  3104.      (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3105.               (match_operand:SI 1 "general_operand" "di")
  3106.               (match_operand:SI 2 "general_operand" "di"))
  3107.      0))]
  3108.   "TARGET_68020 && TARGET_BITFIELD
  3109.    && GET_CODE (operands[1]) == CONST_INT"
  3110.   "*
  3111. {
  3112.   if (operands[1] == const1_rtx
  3113.       && GET_CODE (operands[2]) == CONST_INT)
  3114.     {    
  3115.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3116.       return output_btst (operands,
  3117.               gen_rtx (CONST_INT, VOIDmode,
  3118.                    width - INTVAL (operands[2])),
  3119.               operands[0],
  3120.               insn, 1000);
  3121.       /* Pass 1000 as SIGNPOS argument so that btst will
  3122.          not think we are testing the sign bit for an `and'
  3123.      and assume that nonzero implies a negative result.  */
  3124.     }
  3125.   if (INTVAL (operands[1]) != 32)
  3126.     cc_status.flags = CC_NOT_NEGATIVE;
  3127.   return \"bftst %0{%b2:%b1}\";
  3128. }")
  3129.  
  3130. (define_insn ""
  3131.   [(set (cc0)
  3132.     (subreg:HI
  3133.      (zero_extract:SI (match_operand:SI 0 "nonimmediate_operand" "d")
  3134.               (match_operand:SI 1 "general_operand" "di")
  3135.               (match_operand:SI 2 "general_operand" "di"))
  3136.      0))]
  3137.   "TARGET_68020 && TARGET_BITFIELD
  3138.    && GET_CODE (operands[1]) == CONST_INT"
  3139.   "*
  3140. {
  3141.   if (operands[1] == const1_rtx
  3142.       && GET_CODE (operands[2]) == CONST_INT)
  3143.     {    
  3144.       int width = GET_CODE (operands[0]) == REG ? 31 : 7;
  3145.       return output_btst (operands,
  3146.               gen_rtx (CONST_INT, VOIDmode,
  3147.                    width - INTVAL (operands[2])),
  3148.               operands[0],
  3149.               insn, 1000);
  3150.       /* Pass 1000 as SIGNPOS argument so that btst will
  3151.          not think we are testing the sign bit for an `and'
  3152.      and assume that nonzero implies a negative result.  */
  3153.     }
  3154.   if (INTVAL (operands[1]) != 32)
  3155.     cc_status.flags = CC_NOT_NEGATIVE;
  3156.   return \"bftst %0{%b2:%b1}\";
  3157. }")
  3158.  
  3159. (define_insn "seq"
  3160.   [(set (match_operand:QI 0 "general_operand" "=d")
  3161.     (eq (cc0) (const_int 0)))]
  3162.   ""
  3163.   "*
  3164.   cc_status = cc_prev_status;
  3165.   OUTPUT_JUMP (\"seq %0\", \"fseq %0\", \"seq %0\");
  3166. ")
  3167.  
  3168. (define_insn "sne"
  3169.   [(set (match_operand:QI 0 "general_operand" "=d")
  3170.     (ne (cc0) (const_int 0)))]
  3171.   ""
  3172.   "*
  3173.   cc_status = cc_prev_status;
  3174.   OUTPUT_JUMP (\"sne %0\", \"fsne %0\", \"sne %0\");
  3175. ")
  3176.  
  3177. (define_insn "sgt"
  3178.   [(set (match_operand:QI 0 "general_operand" "=d")
  3179.     (gt (cc0) (const_int 0)))]
  3180.   ""
  3181.   "*
  3182.   cc_status = cc_prev_status;
  3183.   OUTPUT_JUMP (\"sgt %0\", \"fsgt %0\", 0);
  3184. ")
  3185.  
  3186. (define_insn "sgtu"
  3187.   [(set (match_operand:QI 0 "general_operand" "=d")
  3188.     (gtu (cc0) (const_int 0)))]
  3189.   ""
  3190.   "* cc_status = cc_prev_status;
  3191.      return \"shi %0\"; ")
  3192.  
  3193. (define_insn "slt"
  3194.   [(set (match_operand:QI 0 "general_operand" "=d")
  3195.     (lt (cc0) (const_int 0)))]
  3196.   ""
  3197.   "* cc_status = cc_prev_status;
  3198.      OUTPUT_JUMP (\"slt %0\", \"fslt %0\", \"smi %0\"); ")
  3199.  
  3200. (define_insn "sltu"
  3201.   [(set (match_operand:QI 0 "general_operand" "=d")
  3202.     (ltu (cc0) (const_int 0)))]
  3203.   ""
  3204.   "* cc_status = cc_prev_status;
  3205.      return \"scs %0\"; ")
  3206.  
  3207. (define_insn "sge"
  3208.   [(set (match_operand:QI 0 "general_operand" "=d")
  3209.     (ge (cc0) (const_int 0)))]
  3210.   ""
  3211.   "* cc_status = cc_prev_status;
  3212.      OUTPUT_JUMP (\"sge %0\", \"fsge %0\", \"spl %0\"); ")
  3213.  
  3214. (define_insn "sgeu"
  3215.   [(set (match_operand:QI 0 "general_operand" "=d")
  3216.     (geu (cc0) (const_int 0)))]
  3217.   ""
  3218.   "* cc_status = cc_prev_status;
  3219.      return \"scc %0\"; ")
  3220.  
  3221. (define_insn "sle"
  3222.   [(set (match_operand:QI 0 "general_operand" "=d")
  3223.     (le (cc0) (const_int 0)))]
  3224.   ""
  3225.   "*
  3226.   cc_status = cc_prev_status;
  3227.   OUTPUT_JUMP (\"sle %0\", \"fsle %0\", 0);
  3228. ")
  3229.  
  3230. (define_insn "sleu"
  3231.   [(set (match_operand:QI 0 "general_operand" "=d")
  3232.     (leu (cc0) (const_int 0)))]
  3233.   ""
  3234.   "* cc_status = cc_prev_status;
  3235.      return \"sls %0\"; ")
  3236.  
  3237. ;; Basic conditional jump instructions.
  3238.  
  3239. (define_insn "beq"
  3240.   [(set (pc)
  3241.     (if_then_else (eq (cc0)
  3242.               (const_int 0))
  3243.               (label_ref (match_operand 0 "" ""))
  3244.               (pc)))]
  3245.   ""
  3246.   "*
  3247. {
  3248.   OUTPUT_JUMP (\"beq %l0\", \"fbeq %l0\", \"beq %l0\");
  3249. }")
  3250.  
  3251. (define_insn "bne"
  3252.   [(set (pc)
  3253.     (if_then_else (ne (cc0)
  3254.               (const_int 0))
  3255.               (label_ref (match_operand 0 "" ""))
  3256.               (pc)))]
  3257.   ""
  3258.   "*
  3259. {
  3260.   OUTPUT_JUMP (\"bne %l0\", \"fbne %l0\", \"bne %l0\");
  3261. }")
  3262.  
  3263. (define_insn "bgt"
  3264.   [(set (pc)
  3265.     (if_then_else (gt (cc0)
  3266.               (const_int 0))
  3267.               (label_ref (match_operand 0 "" ""))
  3268.               (pc)))]
  3269.   ""
  3270.   "*
  3271.   OUTPUT_JUMP (\"bgt %l0\", \"fbgt %l0\", 0);
  3272. ")
  3273.  
  3274. (define_insn "bgtu"
  3275.   [(set (pc)
  3276.     (if_then_else (gtu (cc0)
  3277.                (const_int 0))
  3278.               (label_ref (match_operand 0 "" ""))
  3279.               (pc)))]
  3280.   ""
  3281.   "*
  3282.   return \"bhi %l0\";
  3283. ")
  3284.  
  3285. (define_insn "blt"
  3286.   [(set (pc)
  3287.     (if_then_else (lt (cc0)
  3288.               (const_int 0))
  3289.               (label_ref (match_operand 0 "" ""))
  3290.               (pc)))]
  3291.   ""
  3292.   "*
  3293.   OUTPUT_JUMP (\"blt %l0\", \"fblt %l0\", \"bmi %l0\");
  3294. ")
  3295.  
  3296. (define_insn "bltu"
  3297.   [(set (pc)
  3298.     (if_then_else (ltu (cc0)
  3299.                (const_int 0))
  3300.               (label_ref (match_operand 0 "" ""))
  3301.               (pc)))]
  3302.   ""
  3303.   "*
  3304.   return \"bcs %l0\";
  3305. ")
  3306.  
  3307. (define_insn "bge"
  3308.   [(set (pc)
  3309.     (if_then_else (ge (cc0)
  3310.               (const_int 0))
  3311.               (label_ref (match_operand 0 "" ""))
  3312.               (pc)))]
  3313.   ""
  3314.   "*
  3315.   OUTPUT_JUMP (\"bge %l0\", \"fbge %l0\", \"bpl %l0\");
  3316. ")
  3317.  
  3318. (define_insn "bgeu"
  3319.   [(set (pc)
  3320.     (if_then_else (geu (cc0)
  3321.                (const_int 0))
  3322.               (label_ref (match_operand 0 "" ""))
  3323.               (pc)))]
  3324.   ""
  3325.   "*
  3326.   return \"bcc %l0\";
  3327. ")
  3328.  
  3329. (define_insn "ble"
  3330.   [(set (pc)
  3331.     (if_then_else (le (cc0)
  3332.               (const_int 0))
  3333.               (label_ref (match_operand 0 "" ""))
  3334.               (pc)))]
  3335.   ""
  3336.   "*
  3337.   OUTPUT_JUMP (\"ble %l0\", \"fble %l0\", 0);
  3338. ")
  3339.  
  3340. (define_insn "bleu"
  3341.   [(set (pc)
  3342.     (if_then_else (leu (cc0)
  3343.                (const_int 0))
  3344.               (label_ref (match_operand 0 "" ""))
  3345.               (pc)))]
  3346.   ""
  3347.   "*
  3348.   return \"bls %l0\";
  3349. ")
  3350.  
  3351. ;; Negated conditional jump instructions.
  3352.  
  3353. (define_insn ""
  3354.   [(set (pc)
  3355.     (if_then_else (eq (cc0)
  3356.               (const_int 0))
  3357.               (pc)
  3358.               (label_ref (match_operand 0 "" ""))))]
  3359.   ""
  3360.   "*
  3361. {
  3362.   OUTPUT_JUMP (\"bne %l0\", \"fbne %l0\", \"bne %l0\");
  3363. }")
  3364.  
  3365. (define_insn ""
  3366.   [(set (pc)
  3367.     (if_then_else (ne (cc0)
  3368.               (const_int 0))
  3369.               (pc)
  3370.               (label_ref (match_operand 0 "" ""))))]
  3371.   ""
  3372.   "*
  3373. {
  3374.   OUTPUT_JUMP (\"beq %l0\", \"fbeq %l0\", \"beq %l0\");
  3375. }")
  3376.  
  3377. (define_insn ""
  3378.   [(set (pc)
  3379.     (if_then_else (gt (cc0)
  3380.               (const_int 0))
  3381.               (pc)
  3382.               (label_ref (match_operand 0 "" ""))))]
  3383.   ""
  3384.   "*
  3385.   OUTPUT_JUMP (\"ble %l0\", \"fbngt %l0\", 0);
  3386. ")
  3387.  
  3388. (define_insn ""
  3389.   [(set (pc)
  3390.     (if_then_else (gtu (cc0)
  3391.                (const_int 0))
  3392.               (pc)
  3393.               (label_ref (match_operand 0 "" ""))))]
  3394.   ""
  3395.   "*
  3396.   return \"bls %l0\";
  3397. ")
  3398.  
  3399. (define_insn ""
  3400.   [(set (pc)
  3401.     (if_then_else (lt (cc0)
  3402.               (const_int 0))
  3403.               (pc)
  3404.               (label_ref (match_operand 0 "" ""))))]
  3405.   ""
  3406.   "*
  3407.   OUTPUT_JUMP (\"bge %l0\", \"fbnlt %l0\", \"bpl %l0\");
  3408. ")
  3409.  
  3410. (define_insn ""
  3411.   [(set (pc)
  3412.     (if_then_else (ltu (cc0)
  3413.                (const_int 0))
  3414.               (pc)
  3415.               (label_ref (match_operand 0 "" ""))))]
  3416.   ""
  3417.   "*
  3418.   return \"bcc %l0\";
  3419. ")
  3420.  
  3421. (define_insn ""
  3422.   [(set (pc)
  3423.     (if_then_else (ge (cc0)
  3424.               (const_int 0))
  3425.               (pc)
  3426.               (label_ref (match_operand 0 "" ""))))]
  3427.   ""
  3428.   "*
  3429.   OUTPUT_JUMP (\"blt %l0\", \"fbnge %l0\", \"bmi %l0\");
  3430. ")
  3431.  
  3432. (define_insn ""
  3433.   [(set (pc)
  3434.     (if_then_else (geu (cc0)
  3435.                (const_int 0))
  3436.               (pc)
  3437.               (label_ref (match_operand 0 "" ""))))]
  3438.   ""
  3439.   "*
  3440.   return \"bcs %l0\";
  3441. ")
  3442.  
  3443. (define_insn ""
  3444.   [(set (pc)
  3445.     (if_then_else (le (cc0)
  3446.               (const_int 0))
  3447.               (pc)
  3448.               (label_ref (match_operand 0 "" ""))))]
  3449.   ""
  3450.   "*
  3451.   OUTPUT_JUMP (\"bgt %l0\", \"fbnle %l0\", 0);
  3452. ")
  3453.  
  3454. (define_insn ""
  3455.   [(set (pc)
  3456.     (if_then_else (leu (cc0)
  3457.                (const_int 0))
  3458.               (pc)
  3459.               (label_ref (match_operand 0 "" ""))))]
  3460.   ""
  3461.   "*
  3462.   return \"bhi %l0\";
  3463. ")
  3464.  
  3465. ;; Subroutines of "casesi".
  3466.  
  3467. (define_expand "casesi_1"
  3468.   [(set (match_operand:SI 3 "general_operand" "")
  3469.     (plus:SI (match_operand:SI 0 "general_operand" "")
  3470.          ;; Note operand 1 has been negated!
  3471.          (match_operand:SI 1 "immediate_operand" "")))
  3472.    (set (cc0) (compare (match_operand:SI 2 "general_operand" "")
  3473.                (match_dup 3)))
  3474.    (set (pc) (if_then_else (ltu (cc0) (const_int 0))
  3475.                (label_ref (match_operand 4 "" "")) (pc)))]
  3476.   ""
  3477.   "")
  3478.  
  3479. (define_expand "casesi_2"
  3480.   [(set (match_operand:SI 0 "" "") (mem:HI (match_operand:SI 1 "" "")))
  3481.    ;; The USE here is so that at least one jump-insn will refer to the label,
  3482.    ;; to keep it alive in jump_optimize.
  3483.    (parallel [(set (pc)
  3484.            (plus:SI (pc) (match_dup 0)))
  3485.           (use (label_ref (match_operand 2 "" "")))])]
  3486.   ""
  3487.   "")
  3488.  
  3489. ;; Operand 0 is index (in bytes); operand 1 is minimum, operand 2 themaximum;
  3490. ;; operand 3 is CODE_LABEL for the table;
  3491. ;; operand 4 is the CODE_LABEL to go to if index out of range.
  3492. (define_expand "casesi"
  3493.   ;; We don't use these for generating the RTL, but we must describe
  3494.   ;; the operands here.
  3495.   [(match_operand:SI 0 "general_operand" "")
  3496.    (match_operand:SI 1 "immediate_operand" "")
  3497.    (match_operand:SI 2 "general_operand" "")
  3498.    (match_operand 3 "" "")
  3499.    (match_operand 4 "" "")]
  3500.   ""
  3501.   "
  3502. {
  3503.   rtx table_elt_addr;
  3504.   rtx index_diff;
  3505.  
  3506.   operands[1] = negate_rtx (SImode, operands[1]);
  3507.   index_diff = gen_reg_rtx (SImode);
  3508.   /* Emit the first few insns.  */
  3509.   emit_insn (gen_casesi_1 (operands[0], operands[1], operands[2],
  3510.                index_diff, operands[4]));
  3511.   /* Construct a memory address.  This may emit some insns.  */
  3512.   table_elt_addr
  3513.     = memory_address_noforce
  3514.         (HImode,
  3515.      gen_rtx (PLUS, Pmode,
  3516.           gen_rtx (MULT, Pmode, index_diff,
  3517.                gen_rtx (CONST_INT, VOIDmode, 2)),
  3518.           gen_rtx (LABEL_REF, VOIDmode, operands[3])));
  3519.   /* Emit the last few insns.  */
  3520.   emit_insn (gen_casesi_2 (gen_reg_rtx (HImode), table_elt_addr, operands[3]));
  3521.   DONE;
  3522. }")
  3523.  
  3524. ;; Recognize one of the insns resulting from casesi_2.
  3525. (define_insn ""
  3526.   [(set (pc)
  3527.     (plus:SI (pc) (match_operand:HI 0 "general_operand" "r")))
  3528.    (use (label_ref (match_operand 1 "" "")))]
  3529.   ""
  3530.   "*
  3531.   return \"jmp %l1(%0.w)\";
  3532. ")
  3533.  
  3534. ;; Unconditional and other jump instructions
  3535. (define_insn "jump"
  3536.   [(set (pc)
  3537.     (label_ref (match_operand 0 "" "")))]
  3538.   ""
  3539.   "*
  3540.   return \"bra %l0\";
  3541. ")
  3542.  
  3543. (define_insn ""
  3544.   [(set (pc)
  3545.     (if_then_else
  3546.      (ne (compare (plus:HI (match_operand:HI 0 "general_operand" "g")
  3547.                    (const_int -1))
  3548.               (const_int -1))
  3549.          (const_int 0))
  3550.      (label_ref (match_operand 1 "" ""))
  3551.      (pc)))
  3552.    (set (match_dup 0)
  3553.     (plus:HI (match_dup 0)
  3554.          (const_int -1)))]
  3555.   ""
  3556.   "*
  3557. {
  3558.   if (DATA_REG_P (operands[0]))
  3559.     return \"dbra %0,%l1\";
  3560.   if (GET_CODE (operands[0]) == MEM)
  3561.     {
  3562.       return \"subq.w #1,%0\;bcc %l1\";
  3563.     }
  3564.   return \"subq.w #1,%0\;cmp.w #-1,%0\;bne %l1\";
  3565. }")
  3566.  
  3567. (define_insn ""
  3568.   [(set (pc)
  3569.     (if_then_else
  3570.      (ne (compare (plus:SI (match_operand:SI 0 "general_operand" "g")
  3571.                    (const_int -1))
  3572.               (const_int -1))
  3573.          (const_int 0))
  3574.      (label_ref (match_operand 1 "" ""))
  3575.      (pc)))
  3576.    (set (match_dup 0)
  3577.     (plus:SI (match_dup 0)
  3578.          (const_int -1)))]
  3579.   ""
  3580.   "*
  3581. {
  3582.   if (DATA_REG_P (operands[0]))
  3583.     return \"dbra %0,%l1\;clr.w %0\;subq.l #1,%0\;bcc %l1\";
  3584.   if (GET_CODE (operands[0]) == MEM)
  3585.     return \"subq.l #1,%0\;bcc %l1\";
  3586.   return \"subq.l #1,%0\;cmp.l #-1,%0\;bne %l1\";
  3587. }")
  3588.  
  3589. ;; dbra patterns that use REG_NOTES info generated by strength_reduce.
  3590.  
  3591. (define_insn ""
  3592.   [(set (pc)
  3593.     (if_then_else
  3594.       (ge (plus:SI (match_operand:SI 0 "general_operand" "g")
  3595.             (const_int -1))
  3596.           (const_int 0))
  3597.       (label_ref (match_operand 1 "" ""))
  3598.       (pc)))
  3599.    (set (match_dup 0)
  3600.     (plus:SI (match_dup 0)
  3601.          (const_int -1)))]
  3602.   "find_reg_note (insn, REG_NONNEG, 0)"
  3603.   "*
  3604. {
  3605.   if (DATA_REG_P (operands[0]))
  3606.     return \"dbra %0,%l1\;clr.w %0\;subq.l #1,%0\;bcc %l1\";
  3607.   if (GET_CODE (operands[0]) == MEM)
  3608.     return \"subq.l #1,%0\;bcc %l1\";
  3609.   return \"subq.l #1,%0\;cmp.l #-1,%0\;bne %l1\";
  3610. }")
  3611.  
  3612. ;; Call subroutine with no return value.
  3613. (define_insn "call"
  3614.   [(call (match_operand:QI 0 "general_operand" "o")
  3615.      (match_operand:SI 1 "general_operand" "g"))]
  3616.   ;; Operand 1 not really used on the m68000.
  3617.   ""
  3618.   "*
  3619. {
  3620.   char *name;
  3621.   
  3622.   if (GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  3623.     {
  3624.       name = XSTR (XEXP (operands[0], 0), 0);
  3625.  
  3626.       if (name[1] == ';')
  3627.         {
  3628.           operands[0] = gen_rtx (MEM, QImode,
  3629.                                   gen_rtx (SYMBOL_REF, SImode, name+2));
  3630.             return \"DC.W %0\";
  3631.         }
  3632.     }
  3633.   if (TARGET_FX30 && GET_CODE (XEXP (operands[0], 0)) == SYMBOL_REF)
  3634.     {
  3635.       return \"DC.W $61ff ; bsr.l\;DC.L %0-m#start-*\";
  3636.     }
  3637.   return \"jsr %0\";
  3638. }")
  3639.  
  3640. ;; Call subroutine, returning value in operand 0
  3641. ;; (which must be a hard register).
  3642. (define_insn "call_value"
  3643.   [(set (match_operand 0 "" "rf")
  3644.     (call (match_operand:QI 1 "general_operand" "o")
  3645.           (match_operand:SI 2 "general_operand" "g")))]
  3646.   ;; Operand 2 not really used on the m68000.
  3647.   ""
  3648.   "*
  3649. {
  3650.   char *name;
  3651.   
  3652.   if (GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  3653.     {
  3654.       name = XSTR (XEXP (operands[1], 0), 0);
  3655.  
  3656.       if (name[1] == ';')
  3657.         {
  3658.           operands[1] = gen_rtx (MEM, QImode,
  3659.                                   gen_rtx (SYMBOL_REF, SImode, name+2));
  3660.             return \"DC.W %1\";
  3661.         }
  3662.     }
  3663.   if (TARGET_FX30 && GET_CODE (XEXP (operands[1], 0)) == SYMBOL_REF)
  3664.     {
  3665.       return \"DC.W $61ff ; bsr.l\;DC.L %1-m#start-*\";
  3666.     }
  3667.   return \"jsr %1\";
  3668. }")
  3669.  
  3670. (define_insn "return"
  3671.   [(return)]
  3672.   "0"
  3673.   "ret 0")
  3674.  
  3675. (define_insn "nop"
  3676.   [(const_int 0)]
  3677.   ""
  3678.   "nop")
  3679.  
  3680. ;; This should not be used unless the add/sub insns can't be.
  3681.  
  3682. (define_insn ""
  3683.   [(set (match_operand:SI 0 "general_operand" "=a")
  3684.     (match_operand:QI 1 "address_operand" "p"))]
  3685.   ""
  3686.   "lea %a1,%0")
  3687.  
  3688. ;; This is the first machine-dependent peephole optimization.
  3689. ;; It is useful when a floating value is returned from a function call
  3690. ;; and then is moved into an FP register.
  3691. ;; But it is mainly intended to test the support for these optimizations.
  3692.  
  3693. (define_peephole
  3694.   [(set (reg:SI 15) (plus:SI (reg:SI 15) (const_int 4)))
  3695.    (set (match_operand:DF 0 "register_operand" "f")
  3696.     (match_operand:DF 1 "register_operand" "ad"))]
  3697.   "FP_REG_P (operands[0]) && ! FP_REG_P (operands[1])"
  3698.   "*
  3699. {
  3700.   rtx xoperands[2];
  3701.   xoperands[1] = gen_rtx (REG, SImode, REGNO (operands[1]) + 1);
  3702.   output_asm_insn (\"move.l %1,(sp)\", xoperands);
  3703.   output_asm_insn (\"move.l %1,-(sp)\", operands);
  3704.   return \"fmove.d (sp)+,%0\";
  3705. }
  3706. ")
  3707.  
  3708.  
  3709. ;;- Local variables:
  3710. ;;- mode:emacs-lisp
  3711. ;;- comment-start: ";;- "
  3712. ;;- comment-start-skip: ";+- *"
  3713. ;;- eval: (set-syntax-table (copy-sequence (syntax-table)))
  3714. ;;- eval: (modify-syntax-entry ?[ "(]")
  3715. ;;- eval: (modify-syntax-entry ?] ")[")
  3716. ;;- eval: (modify-syntax-entry ?{ "(}")
  3717. ;;- eval: (modify-syntax-entry ?} "){")
  3718. ;;- End:
  3719.